in reply to Re^2: Faster of two options for finding keywords in a database
in thread Faster of two options for finding keywords in a database

As soon as undef is used as value, your code will break. Better be safe than sorry.

Debugger demo:

DB<2> $h{a}=1 DB<3> $h{b}=undef DB<4> x grep {defined $h{$_}} "a".."d" 0 'a' DB<5> x grep {exists $h{$_}} "a".."d" 0 'a' 1 'b' DB<6>

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery