in reply to print tab within an element of an array
So do I understand correctly your input file contains literal backslashes followed by a letter, and not the control characters themselves?
IMO the best way to do this is make the replacements yourself, e.g. $string =~ s/\\n/\n/g; $string =~ s/\\t/\t/g; (Update before posting: as choroba just showed too). There are of course other ways (trickery with eval, which should be considered unsafe, or CPAN modules), but if it's just those two characters, doing the replacement yourself is probably easiest. Note those regexes don't take into account multiple backslashes, that is, if your input contains \\n or \\\\n - you'd have to show us more sample input if that is the case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: print tab within an element of an array
by oldmonk201 (Initiate) on Jan 24, 2018 at 12:33 UTC |