Re: Calling a perl script with a perl script

2002-01-04 Thread Connie Chan

# program main.pl
require "testprog.pl";
@data = add1( 100, 1000, 1);

# program testprog.pl
sub add1($,$,$)
{
my ($a, $b, $c) = @_;
$a++ ; $b++ ; $c++;
return ($a, $b, $c)
}

when you run main.pl, you got @data = (101, 1001, 10001)

have a nice day =)

- Original Message -
From: "Hubert Ian M. Tabug" <[EMAIL PROTECTED]>
To: "Perl" <[EMAIL PROTECTED]>
Sent: Friday, January 04, 2002 2:15 PM
Subject: Calling a perl script with a perl script


Hi,

Given that I have a perl script main.pl, and I want main.pl to
"use/call" the script testprog.pl, and store testprog.pl's output into a
variable that can be used within main.pl. How do I go about doing it? Your
help would be greatly appreciated.

Thanks,
Hubert



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Calling a perl script with a perl script

2002-01-04 Thread Jon Molin

"Hubert Ian M. Tabug" wrote:
> 
> Hi,
> 
> Given that I have a perl script main.pl, and I want main.pl to "use/call" 
>the script >testprog.pl, and store testprog.pl's output into a variable that can be 
>used within main.pl. >How do I go about doing it? Your help would be greatly 
>appreciated.


it's not possible for you to import the code with use/require?
if not use
my $output = `perl testprog.pl`;

/Jon

> 
> Thanks,
> Hubert

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]