<?xml version="1.0" encoding="windows-1252"?>
<node id="267482" title="Re: Lexical vs. Package Variables (With a little local thrown in)" created="2003-06-20 04:28:50" updated="2005-07-19 22:20:18">
<type id="11">
note</type>
<author id="261697">
ant9000</author>
<data>
<field name="doctext">
I find your explanations nice and clear; maybe you could
also append the output of your scripts, just to make your points even easier to grasp.&lt;br&gt;
A note about &lt;code&gt;local&lt;/code&gt;: it's real use is for temporarily overwriting Perl's automatic variables, which cannot be redeclared as lexicals, for instance&lt;br&gt;
&lt;code&gt;
#here $/ is usually a newline (on Unix, at least)
{
#localize the input record separator and undefine it
local $/=undef;
#now reading from STDIN yelds the entire contents at once
my $whole_file=&lt;&gt;;
#do what you like with lexical $whole_file
#...
}
#here $/ is restored back to its original value
&lt;/code&gt;
</field>
<field name="root_node">
95813</field>
<field name="parent_node">
95813</field>
</data>
</node>
