in reply to Determining subroutine return type
sub example { if(wantarray) { return (1,2,3); } return [1,2,3]; } my @array = example(); my $arrayref = example();
All references are scalar, so you will still need to check them with ref. (Although perhaps it would be easier to redefine your subs so you always know what kind of reference they return.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Determining subroutine return type
by satchm0h (Beadle) on Feb 24, 2005 at 22:10 UTC |