in reply to Value of $_ inside a regex

Morning Athanasius and compliments for your discover: dive into Perl seems a neverendig story..

My little contribution: i searched in perlretut and I read:
Normally, regexps are a part of Perl expressions. Code evaluation expressions turn that around by allowing arbitrary Perl code to be a part of a regexp. A code evaluation expression is denoted (?{code}), with code a string of Perl statements. Be warned that this feature is considered experimental, and may be changed without notice.
Maybe this is the right place to include some words about what you observed. But the behaviour is not a concern of $_ but instead a concern of the (?{code}) construct. In the other side, first words about $_ are:
The default input and pattern-searching space.
From this point of view the behaviour of $_ is the same i observed in every block of Perl code: id est 'The current thing' or, as we speak latin, the current 'quidquid'. It seems the the current thing inside a regex is the target string, not so bad. This generally speaking; for the key-value question i need to understand it well..

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Value of $_ inside a regex (?{ code })
by Anonymous Monk on Oct 12, 2015 at 08:10 UTC
    Aha, so we're talking about a specific construct, the http://perldoc.perl.org/perlre.html#%28?{-code-}%29, which says
    inside a (?{...}) block, $_ refers to the string the regular expression is matching against. You can also use pos() to know what is the current position of matching within this string.
      so that part is documented; good to know.

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      I see this statement in the documentation of  (?{...}) in perlre back to 5.8.9. But nothing like it for  (??{...}) Interesting.


      Give a man a fish:  <%-{-{-{-<