in reply to Subroutine Reference in a Regexp?
That'd be (??{ code }) - live demo of the following (requires a modern browser; don't mind the "Subroutine redefined" warnings, I'll have to get around to fixing those):
use warnings; use strict; my $string = "more than one part\nanother sentence more than"; sub getone { qr/more/ } sub gettwo { qr/than/ } while ( $string =~ m{( (??{getone}) \s+ (??{gettwo}) )}xg ) { print "<$1>\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subroutine Reference in a Regexp?
by Eily (Monsignor) on Nov 09, 2018 at 16:59 UTC | |
by haukex (Archbishop) on Nov 10, 2018 at 14:44 UTC | |
|
Re^2: Subroutine Reference in a Regexp?
by Amblikai (Scribe) on Nov 08, 2018 at 20:39 UTC |