note
stefp
Oops, I forgot it. I always localize or lexicalize variables
proper to a subroutine
That's why I never noticed that <tt>$_</tt> is not implicetely localized at the entry of a subroutine contrary to what I thought.<p/>
Sadly, localizing <tt>*_</tt> or <tt>$_</tt> doesn't play
well with reference shuffling of strings with positions.
<code>
sub lexer { (*_) = @_; print $1 if m/\G(A)/gc || m/\G(B)/gc ; }
my $a = "AB"; lexer \$a; ; lexer \$a;
</code>
This prints "A" then "B";
If I add a <tt>local *_</tt> or a <tt>local $_</tt>,
at the entry of the lexer routine, that does not work anymore.
So much for a cool trick.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-31579">
<p> -- <a href="/index.pl?node=stefp&lastnode_id=1072">
stefp</a> <br>
</div></div>
527473
527478