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); }
In reply to return data from a subroutine reference... by abachus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |