... you might want to use this reverse dispatch method...
I agree with the "hash-of-subrefs as dispatch table" recommendation, but the trinary operator is overkill here -- we don't have to worry about catching the "exists but false case" so a regular alternation would be enough:
( $hash{$funct} || \&some_default )->();
In reply to Re: Re: Redirection within a Perl script
by simonm
in thread Redirection within a Perl script
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |