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.
--MidLifeXis
In reply to Re^3: REGEX Non-Destructive Flag
by MidLifeXis
in thread REGEX Non-Destructive Flag
by mmartin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |