in reply to Undefined Hash Values and Ternary Operators
$a = undef; %H = ( 'x' => 'y', 'y' => $a, 'z' => 'a' ); for (1..10000) { print "FOO\n" if $H{x} ne 'y'; }
Nothing prints. The ternary operator work how you are using it. You are likely getting a warning because you are calling warn(), with no conditional:
warn "foo" unless defined($a);
Is how you want to use that.
Cheers,
KM
|
|---|