in reply to Re: (jeffa) Re: Returning data from wrapped sub
in thread Returning data from wrapped sub
use strict; use Data::Dumper; my $ref = \&bar; my @arry = foo($ref); $ref = \&baz; my $scal = foo($ref); print Dumper @arry; print Dumper $scal; sub foo { my $ref = shift; my @a = &$ref; return wantarray ? @a : $a[0]; } sub bar { (1..4) } sub baz { [(1..4)] }
jeffa
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) 3Re: Returning data from wrapped sub
by japhy (Canon) on Aug 30, 2001 at 00:57 UTC | |
|
Re (tilly) 4: Returning data from wrapped sub
by tilly (Archbishop) on Aug 30, 2001 at 05:20 UTC | |
|
Re: (jeffa) 3Re: Returning data from wrapped sub
by suaveant (Parson) on Aug 30, 2001 at 01:09 UTC |