[tpm] Is there a three-way version of...

G. Matthew Rice matt at starnix.com
Fri May 29 13:31:42 PDT 2009


On Fri, 2009-05-29 at 16:10 -0400, Mike Stok wrote:
> >    my $title = {aa => 'bing', bb => 'bang'}->{$key} || 'bong';
>
> Or even use // there if your perl is recent enough, in case you ever  
> might have cases involving false but defined strings.
> 
>    my $title = { aa => 'bing', bb => 'bang', cc => '0', dd => '' }- 
>  >{$key} // 'bong';

Err :)  Yeah, I thought of that but after my C crack I didn't want
someone complaining that my sample looked like C++.

--matt




More information about the toronto-pm mailing list