in reply to How do I empty out a hash?
#!/usr/bin/perl -w use strict; my %hash = ( Carol => 22, Mary => 21, Chris => 30 ); my( $k, $v); while(( $k, $v) = each %hash ) { delete $hash{$k}; }
Update: Several followups included these suggestions:
Hope this helps,
-Katie
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I empty out a hash?
by liz (Monsignor) on Aug 16, 2003 at 15:58 UTC | |
|
Re: Answer: How do I empty out a hash?
by NetWallah (Canon) on Aug 16, 2003 at 04:52 UTC | |
by Aristotle (Chancellor) on Aug 16, 2003 at 18:07 UTC |