Look carefully at the sequence and line numbers of the carp output from this:
  
use strict; use vars qw($obj); use Carp qw(carp croak cluck confess); use Cwd; sub TIESCALAR { my $var; carp "tie:\t",\$var," = $_[0]\n"; bless \$var + => shift; } sub FETCH { carp "fetch:\t$_[0] == ${$_[0]}\n"; ${$_[0]} } sub STORE { carp "store:\t$_[0] = $_[1]\n"; ${$_[0]} = $_[1]} tie $obj => 'main'; $obj = 'foo'; { my $x = 1; my $y = $obj; local $obj = 'bar'; } ### OUTPUT ### tie: SCALAR(0x8106d78) = main main::TIESCALAR('main') called at - line 10 store: main=SCALAR(0x8106d78) = foo main::STORE('main=SCALAR(0x8106d78)', 'foo') called at - line +11 fetch: main=SCALAR(0x8106d78) == foo main::FETCH('main=SCALAR(0x8106d78)') called at - line 14 fetch: main=SCALAR(0x8106d78) == foo main::FETCH('main=SCALAR(0x8106d78)') called at - line 15 store: main=SCALAR(0x8106d78) = main::STORE('main=SCALAR(0x8106d78)', undef) called at - line +15 store: main=SCALAR(0x8106d78) = bar main::STORE('main=SCALAR(0x8106d78)', 'bar') called at - line +15 store: main=SCALAR(0x8106d78) = foo main::STORE('main=SCALAR(0x8106d78)', 'foo') called at - line +13
I'm not sure exactly what you're asking, but I think this may answer your question :-)
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

In reply to (MeowChow - tied local wierdness) Re3: Aliasing Variables by MeowChow
in thread Aliasing Variables by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.