Perl: How to pass ARGV parameters to another script? -
i wrote perl script launches program , want pass exact argv parameters received launched program.
currently use code:
my $cmd = "script.sh" $params_str = ""; foreach $param (@argv) { $params_str .= " $param"; } $cmd .= " " . $params_str; system($cmd);
but afraid following scenario problematic:
>perl script.pl "param spaces" param2 param3
as call $cmd
first parameter separated 3 parameters, quotation marks removed: param spaces param2 param3
is there elegant way pass parameters correctly?
system()
can used list of parameters,
system("script.sh", @argv);
which preferable way of system
usage, , don't have worry "param spaces"
.
Comments
Post a Comment