in reply to Re: localizing lexical without messing with tie ?
in thread localizing lexical without messing with tie ?

That's not equivalent since the inner variable isn't tied.
  • Comment on Re^2: localizing lexical without messing with tie ?

Replies are listed 'Best First'.
Re^3: localizing lexical without messing with tie ?
by BrowserUk (Patriarch) on Sep 08, 2010 at 03:21 UTC

    #! perl -slw use strict; { package NewStdScalar; require Tie::Scalar; our @ISA = qw(Tie::StdScalar); sub FETCH { return ${+shift}++ } } package main; tie my $scalar, 'NewStdScalar'; $scalar=0; print $scalar; # 0 { tie my $scalar, 'NewStdScalar'; $scalar = "---"; # --- print $scalar; } print $scalar; # 1 __END__ C:\test>junk34 0 --- 1

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.