On Fri, 17 Apr 2009 22:02:37 -0500, Chap Harrison wrote:
> 
>       my $foo = ( defined $very_long_expression ? $very_long_expression :
> "n/a" );
[...]
> 
> At some point I thought I read about a shorter way to write this, that
> did not involve repeating the $very_long_expression in the same
> statement.  Perhaps a special variable or something, acting sort of like
> a pronoun.  Anyone know of a shortcut?
> 
> Thanks,
> Chap Harrison
> Perl 5.8.8

Well, if you're able to upgrade to 5.10:

my $foo = $very_long_expression // "n/a";

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to