in reply to Re: in function?
in thread in function?

A more succinct (but semantically equivalent) version of:
foreach (@myarray) { $myhash{$_} = 1; }
is
$myhash{$_}++ for @myarray;
I once heard (somewhere) that doing
if ($myhash{'blah'}) { do_something(); }
(i.e. refering to a key in a hash) causes that key to come into existence, so the above expression may always evaluate as true. I haven't been able to prove this, but I think what you want is the exists function:
if (exists($myhash{'blah'})) { # Do something here }
I quite like using 'exists', it makes code far more readable.