My intention was to call a Child.pl script from a Parent.pl script
I used system() function to call other script.
When using
system("perl Child.pl $argument");
the argument is passed.
But when using
system("Child.pl $argument");
the argument is not passed.
Is that because of any mistake in code.
I am a novice in perl scripting. Pardon me if i am asking any blunder.
I am using windows 7 and my perl version is v5.8.4
My Parent.pl script is
use warnings;
print "Inside Parent Script\n\n";
$var = 10;
print "Calling system without perl prefix\n";
system("Child.pl $var");
print "\nCalling system with perl prefix\n";
system("perl Child.pl $var");
print "\nEnd of Parent Script\n";
exit 0;
My Child.pl script is
use warnings;
print "\tInside Child Script\n";
print "\tArgument = $ARGV[0] \n";
print "\tEnd of Child Secipt\n";
exit 0;
My Output is
Inside Parent Script
Calling system without perl prefix
Inside Child Script
Use of uninitialized value in concatenation (.) or string at C:\Child.pl line 4.
Argument =
End of Child Script
Calling system with perl prefix
Inside Child Script
Argument = 10
End of Child Script
End of Parent Script
It seems like in some PC its working without perl prefix.
I am dealing with a huge junk of scripts which does not use perl prefix.
Is there any way i can keep those scripts intact and still make the argument pass through.