Forum Moderators: coopster
Ok Here is my current code:
------------------------------------------
<?php
ob_start();
passthru ("/usr/local/etc/httpd/htdocs/#*$!X/testing.cgi");
$results = ob_get_contents();
ob_end_clean();
echo $results;
?>
and Here is my CGI Code:
------------------------------------------
#!/usr/bin/perl -wT
sub test {
my @n;
$n[0] = 10;
$n[1] = 17;
$n[2] = 23;
return @n;
}
($first,$second,$third) = test();
print "$first-$second-$third";
----------------------------------------------
If I run the code above I got this: 10-17-23
! BIG HOWEVER !
I would like to pass a value $myNumber to $n[0];
simple say the result I hope is:
if I set $myNumber = 10000
then I got this: 10000-17-23
Big Thanks
Is this just an example? Because you certainly don't need to pass a variable to a cgi script just to get that task accomplished, you could do it right in the PHP script itself. However, if you must pass it, why not just add it to your command line execution as an argument?
And this may make it easier to under stand:
------------------------------------------
#!/usr/bin/perl -wT
sub test {
my @n;
$n[0] = $mySuperNumber(Somehow pass this value from php and use here);
$n[1] = 17;
$c = $n[0] + $n[1];
return $c;
}
($NewResult) = test();
print "$NewResult";
----------------------------------------------
Then I can use the php code above to get the value of this $NewResult
Am I make myself clear?