I have a perl script test.pl which reads arguments from the command line
#!/usr/bin/perl -w for( @ARGV ) { print( "$_\n" ) } ;
This works well when I pass parameters like "a b" "c d" e on the command line
The result is:
a b c d e
If I declare a variable
X='"a b" "c d" e'and then run
test.pl $XI get
"a b" "c d" e
I need to run the perl script from various shell scripts as a helper function and the parameters are calculated by those scripts.
The parameter count is not fixed so I have to pass it as a list.
Alas I cannot find a way to get the perl program handle my parameters as desired.
I have thought of passing the parameters through file but then the manual invocation of the perl script from the command line becomes awkward.
How can I get the perl script preserve the spaces in the paramters?
In reply to passing parameters from shell script to perl program doesn't preserve spaces [solved] by peterbk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |