FAQ

On Mon, May 23, 2016 at 10:48:26AM -0700, Daniel Șuteu wrote:
my $str = "foo";
$str =~ /(?{ s{}{} })/;
As has been pointed out elsewhere in this ticket, an empty pattern
is interpreted as the "last successful match". The re-eval
mechanism takes this as being the currently executing pattern,
and so you get infinite recursion.

Marking the currently executing pattern as 'last successful'
is necessary within an re-eval so that things like $1 are visible:

     #prints "a"
     "ab" =~ /(.)(?{ print "[$1]\n" })/;

--
"You're so sadly neglected, and often ignored.
A poor second to Belgium, When going abroad."
     -- Monty Python, "Finland"

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 16 | next ›
Discussion Overview
groupperl5-porters @
categoriesperl
postedMay 23, '16 at 5:48p
activeMay 30, '16 at 9:13p
posts16
users5
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase