If you put double quotes around the environment variable, its spaces will be preserved.
X='"a b" "c d" e' ; perl -e'for( @ARGV ) { print( "$_\n" ) } ;' "$X"You can then parse each argument.
X='"a b" "c d" e' ; perl -e'for( @ARGV ) { print "$1\n" while /\G\s*("[^"]*"|\S+)/gc } ;' "$X"In reply to Re: passing parameters from shell script to perl program doesn't preserve spaces [solved]
by shawnhcorey
in thread passing parameters from shell script to perl program doesn't preserve spaces [solved]
by peterbk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |