in reply to Split a string to remove quotes and parentheses
Another way is the "tr" operator, which simply does character transliterations. In this case, you can "transliterate" the unwanted characters to nothing -- i.e. delete them:
This is a simpler operation than regex substitution, so if your code needs to do this a lot, you could see a performance difference.my $string = '"(test123)"'; $string =~ tr/()"//d;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split a string to remove quotes and parentheses
by Anonymous Monk on May 31, 2016 at 13:34 UTC |