in reply to passing variables between subroutines
you pull them off the @_ array you can shift them off the array individually or assign them in one shot as shown above. <edit> alternatively, if you have only one parameter you can do the following my $param_one = shift @_</edit>foo("test","test2"); sub foo { my ($param_one,$param_two) = @_; print $param_one . "-".$param_two."\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: passing variables between subroutines
by bunnyman (Hermit) on Jan 16, 2006 at 21:17 UTC | |
|
Re^2: passing variables between subroutines
by blazar (Canon) on Jan 17, 2006 at 10:33 UTC |