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 whole string into a variable. For example:
./script.pl --string=blah blah blah blah yup --another-opt
I need "blah blah blah blah yup" in variable $string. I know Getopt::Long supports multiple inputs for one argument when you know how many you will have (which I do not). Is this possible?
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