Now that I am learning how to work with complex data structures, I find myself writing things like this a lot:

my $foo = ( defined $very_long_expression ? $very_long_expression : "n/a" );

or

        my $foo = ( $very_long_expression > 0 ? $very_long_expression : 0 );

(Where the long expression typically involves dereferencing hashes of arrays of hashes.)

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

--
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