Jonathan, why do you seem to send all you messages with "Importance: high"
and "X-Priority: 1"? Do you think you're special or all your messages are
more urgent than other people's? Crying "wolf" like this gets old after a
while.

Alloun, Jonathan wrote:
> I need to call a PERL script from within a PERL script. What 
> is the best way to do this???

Possibly do(). Possibly system().

> The script I will call will need to be passed some parameters as well.

Well, you could do something like

    system "$^X script.pl foo bar baz";

. But that needlessly loads an extra copy of the perl interpreter into
memory. If you have control over the script that will be called, it's
probably better to write a function that takes the values as parameters,
rather than using @ARGV; that way, you can use do() or require() to load and
parse the script with the existing perl interpreter (this will define the
function) and then just call the function with the appropriate values. For
example,

    require "script.pl";
    myfunction('foo', 'bar', 'baz);

The main difference between require and do is that require will only load a
file once, even if you require it multiple times (fine if you just count on
the file to declare subroutines, possibly not fine if you need it to run
initialisation code before each use), and that it requires the script to
return a true value. But `perldoc -f require` will also tell you that.

If you don't have control over the script, you may have to treat it as a
black box and like "any other executable" -- and use system().

By the way, it's generally Perl (the language) or perl (the program). Not
PERL. See "What's the difference between "perl" and "Perl"?" in perlfaq1.

Cheers,
Philip
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to