in reply to
Re: REGEX Non-Destructive Flag
in thread REGEX Non-Destructive Flag
Hey toolic, thanks for the reply.
Ok I was afraid of that... Thanks
Is there an easier way (less lines) that I could use with my version like my previous example (i.e. $str = $str2 =~ s/pattern/replace/r; ).
The only way I can think to do this without changing the original string is:
my $str1 = "How-Are-You-Doing"
my $str2 = $str1
$str2 =~ s/-/ /;
Hello How Are You Doing
perl -ne '(my $foo = $_) =~ s/-/ /g;'
The assignment returns an lvalue which then gets the substitution run on it. Basically the same as yours, just in one statement.
A foolish day
Just another day
Internet cleaning day
The real first day of Spring
The real first day of Autumn
Wait a second, ... is this poll a joke?
Results (487 votes),