sub routine_A { my ($name) = getinfo('name'); print $name; } sub routine_B { my ($address) = getinfo('address'); print $address; } sub getinfo { my %data; $data{name} = "Sam"; $data{address} = "123 Main St"; return @data{ @_ }; } routine_A; routine_B; print getinfo( 'name', 'address' );
In reply to Re: More efficient return of values from sub
by fglock
in thread More efficient return of values from sub
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |