in reply to Redirection within a Perl script
Update: While the trinary operator is overkill in this example, if the script and the dispatch hash were persistent, you would want to do it this way so as to not define any new keys in the hash, and open up a possible source of a memory leak. Also Zaxo++ for pointing out what a regular dispatch hash is, which is more straightforward than the code I linked to (though a regular example is in the parent of the linked node).(exists $hash{$funct} ? $hash{$funct} : \&some_default)->();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Redirection within a Perl script
by bradcathey (Prior) on Dec 04, 2003 at 03:13 UTC | |
|
Re: Re: Redirection within a Perl script
by simonm (Vicar) on Dec 04, 2003 at 04:17 UTC |