Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Call perl script from within another perl script

by dHarry (Abbot)
on Sep 12, 2008 at 11:26 UTC ( #710885=note: print w/ replies, xml ) Need Help??


in reply to Call perl script from within another perl script

To call/invoke/run a Perl script from another Perl script you can also do something like:

# call_another_script.pl use strict; use warnings; do { local @ARGV; @ARGV = ("Hello", "World!"); eval { require "script_to_call.pl" }; }; print "\nOriginal args:\n"; for my $arg (@ARGV) { print "$arg\n"; }

# script_to_cal.pl use strict; use warnings; print "script_to_call.pl args:\n"; for my $arg (@ARGV) { print "$arg\n"; }


Comment on Re: Call perl script from within another perl script
Select or Download Code
Re^2: Call perl script from within another perl script
by charithd (Novice) on Sep 25, 2012 at 06:17 UTC
    hi all, I need to execute perl script(script_to_call.pl) on my remote location can I do it in same way (with @ARGV)? This below one not parse @ARGV:
    do { local @ARGV; @ARGV = ("$OldTime","$NewTime","$WLSP/CDSServer11.log"); eval { system("ssh -o stricthostkeychecking=no $WLS './script_to_c +all.pl'"); }; };

      Instead of asking a question in a 4 year old thread, you should open a new thread. Your problem is also different to the problem addressed in this thread. See safely passing args through ssh for ideas.

        OK sorry for my bad. I will open a new thread. anyway thank you very much for your reply

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://710885]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2014-08-28 15:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls