in reply to While on hashes doesn't work?
Not recommending it, but perhaps it gives insight into how while works (in addition to what gellyfish said above)
#!/usr/bin/perl -w use strict; my %data = ( a01 => "two", a02 => "peas", a03 => "in", a04 => "a", a05 => "pod." ); while (($_) = sort keys %data){ print "while: $data{$_}\n"; delete $data{$_}; } print "while loop terminates because", "%data is now empty >", %data,"< \n"; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: While on hashes doesn't work?
by merlyn (Sage) on Feb 04, 2002 at 23:38 UTC |