in reply to subroutine..help
You're not making any use of the arguments in your subroutine, so $a, $b are both zero.
You shouldn't rely on global variables to convey information in and out of a subroutine. Here is how your code might be better written,
I've renamed $a and $b since they are sacred to sort in Perl.sub coor { my ($c, $d) = @_; return ( $c + 109, $d + 5 ); } my @y1_opp = coor( 1, 5); print "@y1_opp\n";
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: subroutine..help
by hmerrill (Friar) on Oct 29, 2004 at 12:01 UTC |