<br><div><span class="gmail_quote">On 10/31/07, <b class="gmail_sendername">Indy Singh</b> &lt;<a href="mailto:indy@indigostar.com">indy@indigostar.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Guys,<br>Can anyone explain, why taking a reference to an array gives a different<br>value on each iteration of this loop.&nbsp;&nbsp;This is the line of code:<br>&nbsp;&nbsp;my $r = \@f;<br><br>If I move the &quot;my @a&quot; declaration outside the loop I get the same value
<br>each time.<br><br>It seems that on each iteration of the loop a new @f array is created.<br>Does that make sense?</blockquote><div><br>... snip ... <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
foreach $x (@foo) {<br>&nbsp;&nbsp;my @f;</blockquote><div><br>... snip ...<br><br>Yes, this make sense because my @f is a variable declared<br>every time the body of the foreach loop is executed.<br>(for the same reason that the split is executed every
<br>time through the loop too.)<br></div><br></div>