On Friday 09 July 2004 17:14, Christopher J. Bottaro wrote:
> i want to remove items from a hash then later see if they exist using
[..]
> which should i use? delete() or undef()? obviously i could write a small
> script to test this (which i'm going to know), but i'd also like to hear
> from an expert about the subtle (if any) difference between the two if they
> both work.
I don't know what an expert would say, but for testing if a hash contains an
element, I normally use "exists":
if (exists ($hash{'mykey'})) {
print 'mykey exists.';
}
>
> also, are these functionally equivalent?
> $myvar = undef();
> undef($myvar);
I'd think so, but I'm not sure.
HTH,
Philipp
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>