in reply to Hashing uninitialized values when no value returned from DBI sql select

Well, in the end, I really like Kyle's

$myhash{$val_1} = defined $val_2 ? $val_2 : '';

compact if-then-else suggested notation. It's really exactly the If-Else structure I proposed in the OP, just a nice compact notation. Haven't used it much - tend to be more verbose - but this is a good application for it.

Is there a name for this kind of notation?

  • Comment on Re: Hashing uninitialized values when no value returned from DBI sql select

Replies are listed 'Best First'.
Re^2: Hashing uninitialized values when no value returned from DBI sql select
by kyle (Abbot) on Feb 28, 2008 at 16:23 UTC

    Is there a name for this kind of notation?

    I usually hear it called the ternary operator, but it's documented in perlop under "Conditional Operator" so that's probably a better name.