<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 9, 2012, at 12:27 PM, Kenneth S Mclane wrote:</div><blockquote type="cite"><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; while (my @data
= $sr-&gt;next) {</font></tt>&nbsp;</blockquote><br></div><div>The problem is this line of code. @data in a scalar context will evaluate to the index of the last element of the array (-1 if the array is empty) (assuming you haven't changed the index of the first element of arrays). The loop will succeed even when $sr-&gt;next returns undefined.</div><div><br></div><div>Try:</div><div><br></div><div>while( my $data_scalar = $sr-&gt;next ) &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; my @data = $data_scalar-&gt;all;</div><div><br></div><div><br></div><div><br></div><div>instead</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- john romkey</div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://romkey.com/">http://romkey.com/</a></div><div><br></div></body></html>