Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The first while-loop prints out 3 keys with 3 values. The seconds while-loop prints out 4 keys and 4 values. The loops runs one after another. The code is exaclty the same. I am totaly confused. I tried to reprodruce this bug in another code snippets but without success.sub _split_options { my ($self, $opts) = @_; while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } # ... another code }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Found bug: while()
by ikegami (Patriarch) on Oct 13, 2009 at 03:33 UTC | |
by Anonymous Monk on Oct 13, 2009 at 03:49 UTC |