in reply to Re: Pattern Matching with REGEXP: Is the match position trackable?
in thread Pattern Matching with REGEXP: Is the match position trackable?

This does work, but (from perldoc perlvar):
$&   The string matched by the last successful pattern match (not
     counting any matches hidden within a BLOCK or eval() enclosed by
     the current BLOCK). (Mnemonic: like & in some editors.) This
     variable is read-only and dynamically scoped to the current
     BLOCK.

     The use of this variable anywhere in a program imposes a
     considerable performance penalty on all regular expression
     matches. See the BUGS manpage.
  • Comment on Re: Re: Pattern Matching with REGEXP: Is the match position trackable?