<?xml version="1.0" encoding="windows-1252"?>
<node id="1014756" title="Re^4: foreach-loop-local var in sub" created="2013-01-22 13:20:24" updated="2013-01-22 13:20:24">
<type id="11">
note</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
&lt;I&gt;&amp;gt; I'm looking forward to my subs!&lt;/I&gt;&lt;P&gt;&lt;P&gt;

no need to wait it's just another syntax for &lt;c&gt;my $sub =sub {}&lt;/c&gt;, just w/o the need to do dereferencing and occupying a scalar variable.&lt;P&gt;&lt;P&gt;

from [id://1014504]:&lt;P&gt;&lt;P&gt;

&lt;c&gt;
use strict;
use warnings;

foreach (0, 1) {
    my $i = $_;
    my $print = sub {
      print $i;
    };
    $print-&gt;();          # 0,1
}
&lt;/c&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-708738"&gt;
&lt;p&gt;Cheers Rolf
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1014473</field>
<field name="parent_node">
1014578</field>
</data>
</node>
