in reply to Delete "/" in a string
Just a note of caution. I'm not familiar with your use-case, but might simply deleting the / (forward-slash) delimiters be ambiguous? Consider 'POS1/23/4' versus 'POS12/3/4' etc. Maybe better to replace with an innocuous character (note: no /d modifier needed here):
c:\@Work\Perl>perl -wMstrict -le "use 5.014; ;; my $s = 'POS1/23/4'; ;; my $t = $s =~ tr{/}{-}r; print qq{'$s' -> '$t'}; " 'POS1/23/4' -> 'POS1-23-4'
Update: See tr/// in Quote-Like Operators section in perlop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Delete "/" in a string
by WTem (Novice) on Oct 23, 2014 at 19:33 UTC |