Getopt::Long getting a string with spaces into a variable

后端 未结 4 1144
旧时难觅i
旧时难觅i 2021-01-15 09:42

I\'m making a perl script which uses Getopt::Long to parse command line arguments. However, I have an argument which can accept a string (with spaces). How can I get the who

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-15 10:39

    You need to either put quotes around the argument:

    ./script.pl --string="blah blah blah blah yup" --another-opt
    

    or escape the spaces:

    ./script.pl --string=blah\ blah\ blah\ blah\ yup --another-opt
    

提交回复
热议问题