Possible Duplicate:
Getopt::Long getting a string with spaces into a variable
Say I have the following Perl script:
use 5.010;
use strict;
use warnings;
use Getopt::Std;
use vars qw($opt_i $opt_o $opt_m);
&getopts('i:o:m:');
say $opt_m
If I call this script with
perl script.pl -i text -o string -m hello how are you, world?
I don’t get “hello how are you, world?” in $opt_m. How can I capture a string separated by whitespaces as one of the switch arguments to my script?
You are trying to build the string
So you have to use a string literal that builds that string. The syntax for string literals will vary by shell, but you can probably build that string using either of the following: