16:12 >perl -wE "my $string = 'abcde'; $_ = 42; say; $string =~ /(?{ say })/;"
42
abcde
16:12 >perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread
####
use strict;
use warnings;
my %searches =
(
bar => " bar \n\n",
bar1 => " bar1 \nw\n",
baz => "baz",
foo => " foo c \n",
foo1 => " foo ",
);
my $x;
my $regex = qr{ ^ \s* (??{ $x }) \s* $ }x;
for (sort keys %searches)
{
$x = $_;
print "$_: ", $searches{$_} =~ $regex ? 'match' : 'no match', "\n";
}
####
my $regex = qr{ ^ \s* (??{ $_ }) \s* $ }x;