$var = 'this is a string\twith some text\r\n'; $var =~ s/\\t/\t/; $var =~ s/\\r/\r/; $var =~ s/\\n/\n/;