<?xml version="1.0" encoding="windows-1252"?>
<node id="696633" title="Re: Creating Nested Functions" created="2008-07-10 03:46:28" updated="2008-07-09 23:46:28">
<type id="11">
note</type>
<author id="381608">
ikegami</author>
<data>
<field name="doctext">
&lt;p&gt;I was asked about the possibility of using &lt;c&gt;our $inner;&lt;/c&gt; instead of &lt;c&gt;my $inner;&lt;/c&gt;. It's doable.

&lt;c&gt;
sub outer {
   ...
   local our $helper;
   $helper = sub {
      ...
      $helper-&gt;(...);
      ...
   };
   $helper-&gt;(@_);
}
&lt;/c&gt;

&lt;p&gt;&lt;c&gt;local&lt;/c&gt; still needs to be used to protect the current value of the variable and to clear the reference to the helper sub when &lt;c&gt;outer&lt;/c&gt; exits.

&lt;p&gt;I don't see any advantage in localizing $helper instead of &amp;helper. 
</field>
<field name="root_node">
696592</field>
<field name="parent_node">
696592</field>
</data>
</node>
