in reply to Re^2: Combining two actions in RegExp
in thread Combining two actions in RegExp
$phone =~ tr/)(/-/d; says to delete the parentheses and also replace the closing paren with '-';
To also delete any spaces, you could use $phone =~ tr/)(\x20/-/d; where '\x20' is the hex value of a 'space'. You could also use $phone =~ tr/)( /-/d; without the hex value of a space and just use a literal space instead. (The hex version just makes the 'space' more explicit).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Combining two actions in RegExp
by Anonymous Monk on Jan 23, 2018 at 21:00 UTC | |
by AnomalousMonk (Archbishop) on Jan 23, 2018 at 21:18 UTC | |
by Anonymous Monk on Jan 23, 2018 at 21:50 UTC |
In Section
Seekers of Perl Wisdom