in reply to Returning data from wrapped sub
use strict; use Data::Dumper; my $ref = \&bar; my @arry = foo($ref); 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) }
jeffa
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Returning data from wrapped sub
by suaveant (Parson) on Aug 30, 2001 at 00:47 UTC | |
by jeffa (Bishop) on Aug 30, 2001 at 00:53 UTC | |
by japhy (Canon) on Aug 30, 2001 at 00:57 UTC | |
by tilly (Archbishop) on Aug 30, 2001 at 05:20 UTC | |
by suaveant (Parson) on Aug 30, 2001 at 01:09 UTC |