Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

(z) Re: Perl Script Calling Another Perl Script

by zigdon (Deacon)
on Nov 20, 2003 at 20:25 UTC ( [id://308684]=note: print w/replies, xml ) Need Help??


in reply to Perl Script Calling Another Perl Script

Another option, that is probably more efficient, is to take the code from prog2, and move it into a module, that can then be used from many programs:

You would create Code.pm:
sub GenOutput { my @inputs = @_; my $output = "blah"; return $output; } 1;
Then, prog1 can do:
use Code; ... $gimme = &GenOutput($var1, $var2);
And prog2 is:
#!/usr/bin/perl use Code; &GenOutput;
Does that make sense?

-- zigdon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-24 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found