<?xml version="1.0" encoding="windows-1252"?>
<node id="997634" title="Re^4: The difference between my and local" created="2012-10-06 12:15:30" updated="2012-10-06 12:15:30">
<type id="11">
note</type>
<author id="997632">
Nazeerahamed</author>
<data>
<field name="doctext">
You can only localize a "package global variable" but not a lexical variable i.e., declared using "my".
A package global can be created using "use vars qw($pkg_gbl_bar1 $pkg_gbl_bar2)".
Please change your code as below 
&lt;br&gt;use strict;
&lt;br&gt;use vars qw($tt);
&lt;br&gt;$tt = 3.14159;
&lt;br&gt;{
&lt;br&gt; 	local $tt = 3;
&lt;br&gt;	print "In block, \$tt = $tt\n";
&lt;br&gt;	print "In block, \$::tt = $::tt\n";
&lt;br&gt;}
&lt;br&gt;print "Outside block, \$tt = $tt\n";
&lt;br&gt;print "Outside block, \$::tt = $::tt\n";
&lt;br&gt;&lt;br&gt;Hope this helps you. If I am wrong, please let me know.</field>
<field name="root_node">
94007</field>
<field name="parent_node">
578736</field>
</data>
</node>
