Take the 2-minute tour ×  I have a $cbDescription variable in a
Perl script. When I print out $cbDescription, I get the
following:  tIP SOLD -5 /ESH4 @1832.00  I want to remove any +
or - or @ signs or commas from the string, so I have the
following line:  $cbDescription =~ s/[+-\@,]//g;  I expect that
line to change $cbDescription to:  tIP SOLD 5 /ESH4 1832.00  But
when I print out $cbDescription after that line, I get:   Why
did it also remove all the numbers and the decimal point?
share|improve this question  1 Answer 1  up vote 1 down vote
accepted  - is a range delimiter in between brackets sou you
need to escape it:  % echo "tIP SOLD -5 /ESH4 @1832.00" | perl
-pi -e 's/[+\-\@,]//g' tIP SOLD 5 /ESH4 1832.00 share|improve
this answer You can also specify it as the very first character
in the class. –  choroba Feb 16 at 23:43  Your Answer