in reply to foreach loop question
Consider that
is equivalent toforeach ( sort keys %h ) { ... $h{$new} = $new;
The keys have been extracted from the hash before being sorted and processed. Any keys you add after that aren't "visible" to the foreach.@sorted = sort keys %h; foreach ( @sorted ) { ... $h{$new} = $new;
By the way, the "next;" is redundant.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: foreach loop question
by dda (Friar) on Apr 16, 2003 at 18:45 UTC | |
by dws (Chancellor) on Apr 16, 2003 at 18:54 UTC |