in reply to do script2.pl with parms
Using do to call one script from inside another is considered not very elegant. Anyway.
In script2.pl then:#!/usr/bin/perl print "We're in script1 now\n"; @ARGV = ("super", "duper"); do('script2'); print "Back in script1\n";
#!/usr/bin/perl print "\tNow we're in script2\n"; my ($arg1, $arg2) = @ARGV; print "\t- arg1: $arg1\n"; print "\t- arg2: $arg2\n"; print "\tscript2 ends\n";
So, one way to do it is to use @ARGV, the array that contains the list of "command line" arguments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: do script2.pl with parms
by afoken (Chancellor) on Nov 12, 2010 at 13:44 UTC | |
by GrandFather (Saint) on Nov 12, 2010 at 22:02 UTC |