in reply to Re^2: How to pass file paths in a master script which is used to run several perl scripts?
in thread How to pass file paths in a master script which is used to run several perl scripts?
It doesn't work this way. In the master script you define your variables, however you run another perl script via system. It knows nothing about the variables in the master script. Consider the following example: master.pl
#!/usr/bin/perl use strict; use warnings; my $secret = 'BruceWayneisBatman'; my @cmd = ('perl', 'child.pl', $secret); system(@cmd) == 0 or die "system @cmd failed: $?";
child.pl
#!/usr/bin/perl use strict; use warnings; my $message = $ARGV[0]; print "The master script passed: $message\n";
Again see system.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to pass file paths in a master script which is used to run several perl scripts?
by Monk::Thomas (Friar) on Oct 18, 2016 at 12:25 UTC | |
by marto (Cardinal) on Oct 18, 2016 at 12:31 UTC |