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

You don't seem to know what you're looking for. At the very least, it wasn't clearly communicated. Please clarify.

Update: Maybe it's one of these:

Override a global package variable for a static scope:

our $var = 'a'; { my $var = 'x'; print "$var\n"; } # x print "$var\n"; # a
my $var = 'a'; { my $var = 'x'; print "$var\n"; } # x print "$var\n"; # a

Override a global package variable for a dynamic scope: (Doesn't remove magic. Doesn't localise pos() except maybe on recent Perls.)

our $var = 'a'; sub f { print "$var\n"; } { local $var = 'x'; f(); } # x print "$var\n"; # a

Override a global package variable for a dynamic scope:

our $var = 'a'; sub f { print "$var\n"; } { local *var; *var = 'x'; f(); } # x print "$var\n"; # a

Override a global lexical variable for a dynamic scope:

my $var = 'a'; sub f { print "$var\n"; } { ?????; $var = 'x'; f(); } # x print "$var\n"; # a

Replies are listed 'Best First'.
Re^4: localizing lexical without messing with tie ?
by LanX (Saint) on Sep 08, 2010 at 17:53 UTC

      see Re^2: localizing lexical without messing with tie ?.

      What do you call "passed variable"?

      As I said, an additional local untie does what I wanted.

      Doubtful. The untie isn't local. I've provided a solution that works where you used untie.

        > What do you call "passed variable"?

        sub tst (&$) { $_[1]++; # passed variable $_[0]->(); # passed block } tst { print $c} $c;

        Cheers Rolf