T
Tony
Newbie question,
Hi guys,
I need to invoke a perl script from another perlscript
with different parms passed to the second perl script.
Code snippet
==============
my ($no1,$no2) = (0,1)
my $num = "single digit var from other part of program";
my $file = "/some/path/file_"
my $perl_script = "/some/path/perl_program";
if ($num == 1) {
system "$perl_script" , "$file$no1" , "&"; # Invoke $perl_script once
exit(0);
if ($num == 2) {
system "$perl_script" , "$file$no1" , "&"; # Invoke $perl_script 2 times
system "$perl_script" , "$file$no2" , "&"; # with different file name.
exit(0);
# My "$perl_script" program takes the
# file name and processes it in a process that never
# will return, that is why I use "&" so the invoking
# perl script can start the next invocation when there are
# 2 different file names.
The above does not work as expected. With $num = 2 the first
invocation of "$perl_script" runs but not the second one. Killing
the first one using kill PID allows the second one to start, in other
words the "&" does not seem to do what it is supposed to do, let
the calling script continue with the next item on the list.
What am I doing wrong here?
I have tried various combinations of `` '' "" but nothing gives.
Tony
Hi guys,
I need to invoke a perl script from another perlscript
with different parms passed to the second perl script.
Code snippet
==============
my ($no1,$no2) = (0,1)
my $num = "single digit var from other part of program";
my $file = "/some/path/file_"
my $perl_script = "/some/path/perl_program";
if ($num == 1) {
system "$perl_script" , "$file$no1" , "&"; # Invoke $perl_script once
exit(0);
if ($num == 2) {
system "$perl_script" , "$file$no1" , "&"; # Invoke $perl_script 2 times
system "$perl_script" , "$file$no2" , "&"; # with different file name.
exit(0);
# My "$perl_script" program takes the
# file name and processes it in a process that never
# will return, that is why I use "&" so the invoking
# perl script can start the next invocation when there are
# 2 different file names.
The above does not work as expected. With $num = 2 the first
invocation of "$perl_script" runs but not the second one. Killing
the first one using kill PID allows the second one to start, in other
words the "&" does not seem to do what it is supposed to do, let
the calling script continue with the next item on the list.
What am I doing wrong here?
I have tried various combinations of `` '' "" but nothing gives.
Tony