I am currently writing a perl program for linux which needs to run another perl script with a commandline option half way through, 'myscript.pl -h'. If it didn't have the '-h' I would use require. I could use backticks to shell out, but this is slow. Is there a better way to call another perl program with options?
@ARGV = (1, 2, 3, 4, "Hello!"); # set our command line args!
eval{require"inc.pl"};
# the 'eval' catches the exception that occurs when
# inc.pl fails to return true (which can also be alleviated
# by ending "inc.pl" with a true value, such as 1; in a
# line by itself).
}
print"\nOriginal Arguments:\n\n";
formy$item(@ARGV){
print"$item\n";
}
If you run:
perl tmp.pl arg1 arg2 arg3
you'll see the output
1 2 3 4 Hello!
Original Arguments:
arg1 arg2 arg3
But would this take care of the option with which we need to call the perl script?? I too have the same task and I figure out how to call another script with options?
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.