Walt Mankowski on Thu, 9 Dec 1999 10:42:48 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Plug] Perl Question...


On Thu, Dec 09, 1999 at 10:32:17AM -0500, Charles Stack wrote:
> If one has a hash that has, say N elements in it and you want to get rid of
> some, how does one do that?  With perl arrays, one can use $#.  I haven't
> figured out how to do it with hashes without making a new hash table.

If you want to delete key $key from hash %hash, just use the
delete function:

delete $hash{$key};

To remove everything from the hash, use either of these:

%hash = ();
or
undef %hash;

Walt


_______________________________________________
Plug maillist  -  Plug@lists.nothinbut.net
http://lists.nothinbut.net/mail/listinfo/plug