<font face="courier new,monospace"><br></font><br><div class="gmail_quote">On Fri, Jun 22, 2012 at 2:07 PM, Mike Stok <span dir="ltr"><<a href="mailto:mike@stok.ca" target="_blank">mike@stok.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Have you been iterating over the hash before the keys in the print resets the iterator? Maybe the iterator was all but done.<div>
</div></div></blockquote><div><br>Enhancing Mikes sample code a little... this is probably whats really happening.<br><br>I stand corrected/educated!<br>In hind sight, it sorta makes sense that the 'each' just gets the 'next'<br>
thing, and it doesn't know (recognize) that it is inside a loop where<br>the programmer wanted to 'loop over everything'.<br><br>Unfortunately, this is probably something that will bite my behind<br>again in a few years (after I've forgotten this event).<br>
<br><soapbox on><br>Why don't languages/people make things 'intuitively safe'?<br>(or if they can't, then don't add features that come pre-loaded with bullets.)<br><soapbox off><br><br> #!/usr/bin/env perl<br>
<br>use strict;<br>use warnings;<br><br>my %h = (a => 'b', c => 'd');<br><br>while (my ($k, $v) = each %h) {<br> print "$k => $v\n";<br>}<br><br>while (my ($k, $v) = each %h) {<br> print "$k => $v\n";<br>
}<br></div></div><br>