in reply to printing escape characters

use strict; use warnings; my $str = "\tthis is a sample string\nwith various white space charact +ers\n"; my $str2 = $str; $str2 =~ tr/\t \n/\0\1\2/; $str2 =~ s/([\0\1\2])/('\t', '\s', "\\n\n")[ord($1)]/ge; print $str."\n"; print $str2;

Prints:

this is a sample string with various white space characters \tthis\sis\sa\ssample\sstring\n with\svarious\swhite\sspace\scharacters\n

Update: line breaks per sauoq


Perl is Huffman encoded by design.