* David Landgren <[EMAIL PROTECTED]> [2007-11-24 10:45]:
> Uri Guttman writes:
>>>>>>> "AP" == A Pagaltzis <[EMAIL PROTECTED]> writes:
>>   AP> * Jerrad Pierce <[EMAIL PROTECTED]> [2007-11-23 22:50]:
>>   >> exists( $dispatch{$sub} ) ? $dispatch{$sub}->() :
>>   >> warn "Key <$sub> does not exist in the dispatch table";
>>   AP>     ( $dispatch{$sub} || sub { warn "no such action '$sub'" } )->();
>> some variations on that:
>>      my $sub = $dispatch{$key} or die "trying to call missing code" ;
>>      $sub->() ;
>> or:
>
> [...]
>
>> or:
>>      my $sub = $dispatch{ $key } || $dispatch{ 'default' } ;
>
> Why stop there? Assuming $key never evaluates to 0:
>
>   my $sub = $dispatch{ $key || 'default' };

Your dispatch table has keys for all nonzero strings?

That’s one big hash.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to