Reputation:
I'm using the following code in perl script to call another script with argument.
The following code is to call another script
script1.pl
system("start $script_name $from $range1");
The following code is to get the argument value
script2.pl
$from =shift;
$to = shift;
but i don't get any value in using this method. How to pass value to another script and how to get those values?
Upvotes: 0
Views: 208
Reputation: 3253
Instead of using system("start $script_name $from $range1");
Use like following
system("start perl $script_name $from $range1");
This will help you.
Upvotes: 0
Reputation: 36999
This works for me:
script1.pl:
#!/usr/bin/perl
system("./script2.pl 1 2");
script2.pl:
#!/usr/bin/perl
$from = shift @ARGV;
$to = shift @ARGV;
print "$from $to\n";
Upvotes: 2