abachus has asked for the wisdom of the Perl Monks concerning the following question:
hello all,
Isaac.
I'd like to use something like the following code, but how does one get a return value from a call like that ?
thanks,my %arch=( apple => \&mac, sun => \&sparc, hp => \&parisc ); my $type='sun'; if(exists $arch{$type}) { $arch{$type}->("some stuff"); # Where / how to get the returned data ? } else { exit; } sub mac { return(0); } sub sparc { return(1); } sub parisc { return(2); }
Isaac.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: return data from a subroutine reference...
by bobf (Monsignor) on Aug 12, 2006 at 07:43 UTC | |
Re: return data from a subroutine reference...
by perlfan (Vicar) on Aug 12, 2006 at 13:14 UTC | |
Re: return data from a subroutine reference...
by aufflick (Deacon) on Aug 13, 2006 at 07:08 UTC |
Back to
Seekers of Perl Wisdom