in reply to Re: regexp wizardry needed
in thread regexp wizardry needed
perlop says that /r is for non-destructive operation of a regular expression. You can simply replace that by introducing a temporary variable:
my $result = $example =~ s/foo/bar/r;
... can be replaced by
(my $result=$example) =~ s/foo/bar/;
In your case, you will have to make sure your map block actually returns the intended value:
... map { (my $result=$_) =~ s/foo/bar/; $result } @elements
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: regexp wizardry needed
by Anonymous Monk on Jan 25, 2013 at 18:03 UTC | |
by AnomalousMonk (Archbishop) on Jan 26, 2013 at 05:12 UTC |
In Section
Seekers of Perl Wisdom