Re: fun with hashes!

Vladi Belperchinov-Shabanski <[email protected]> Sat, 24 Nov 2007 01:57:23 +0200
Newsgroups gmane.comp.lang.perl.fun
Organization DataMax
Message-ID <[email protected]>
On Fri, 23 Nov 2007 23:18:20 +0100
"A. Pagaltzis" <[email protected]> wrote:

> * Jerrad Pierce <[email protected]> [2007-11-23 22:50]:
> > exists( $dispatch{$sub} ) ? $dispatch{$sub}->() :
> >          warn "Key <$sub> does not exist in the dispatch table";
> 
>     ( $dispatch{$sub} || sub { warn "no such action '$sub'" } )->();
> 

or  &{ ... || ... }->()

just to avoid problems like:

  print ( $dispatch{$sub} || sub { warn  } )->();


-- 
Vladi Belperchinov-Shabanski <[email protected]> <[email protected]>
http://cade.datamax.bg/   pgp/gpg key id: 6F35B214 (pgp.mit.edu)
--
equally destructive as we are, don't you think we've also gone too far?!