J
Jimmy Phillips
I am playing with how to call external scripts but can't get the return
value. Example
Caller script...
*************
#!/usr/bin/perl -w
use strict;
my $result = `./dice.pl 5`;
print $result . "\n";
The called script...
*************
#!/usr/bin/perl -w
use strict;
my $randresult;
$randresult = rand $ARGV[0];
If I run the called script with a commandline ./dice.pl 30 it works fine.
The caller script calls ok but gets back an undef. Obviously because
nothing got returned.
Question, how do I specify the $randresult to be a return value? The
keywork "return" is no good outside of a subroutine.
What am I missing?
Thanks
JP
value. Example
Caller script...
*************
#!/usr/bin/perl -w
use strict;
my $result = `./dice.pl 5`;
print $result . "\n";
The called script...
*************
#!/usr/bin/perl -w
use strict;
my $randresult;
$randresult = rand $ARGV[0];
If I run the called script with a commandline ./dice.pl 30 it works fine.
The caller script calls ok but gets back an undef. Obviously because
nothing got returned.
Question, how do I specify the $randresult to be a return value? The
keywork "return" is no good outside of a subroutine.
What am I missing?
Thanks
JP