- or download this
use 5.010; # needs // (defined-or), \K regex extension
...
return $string;
}
- or download this
c:\@Work\Perl\monks\harangzsolt33>perl replace_1.pl
# replace ALL instances of search string (left-to-right)
...
1..24
ok 25 - no warnings
1..25
- or download this
my $rx_srch = $replace_left_to_right
? qr{ .*? \K $srch }xms # search for leftmost match
: qr{ .* \K $srch }xms # search for rightmost match
;