Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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"; }

Replies are listed 'Best First'.
Re^2: Call perl script from within another perl script
by charithd (Acolyte) 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?
Discipulus was outside The Clash concert in 1985..
[marto]: Wolfsbane , now I'm having flashbacks
[choroba]: Isn't Using PerlPod Creatively rather a meditation?
[choroba]: I don't see a question
[1nickt]: ugh, I stuck my head in the bass bin for 30 seconds on a dare at Ted Nugent at Hammersmith Odeon. Yes, I am 40% deaf now.
[johngg]: My daughter is incredibly jealous of my wife who got to see The Clash at Brixton many years ago. They went to see The Vaccines there recently.
[1nickt]: But the bands are even louder! I saw Spearhead (Michael Franti) at an outdoor show and had to walk a mile away to not feel pain in my chest! Babies were crying ... I asked the sound engineer why it was necessary to have the bass so loud and he laughed...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-03-24 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.