Question: For example I have, 

```
my $str = '\t';
print "My String is ".$str;

```

I want the output to interpret the tab character and return something like:

```
"My String is \t"

```

I am actually getting the value of the string from the database, and it returns it as a single quoted string.

Answer: 
[String::Interpolate](http://p3rl.org/String%3a%3aInterpolate) does exactly that

```
$ perl -MString::Interpolate=interpolate -E 'say "My String is [". interpolate(shift) . "]"' '\t'
My String is [  ]

```
Well, I just tried below workaround it worked. Please have a look

```
my $str1 = "1234\n\t5678";
print $str1; 
#it prints 
#1234
#     5678

$str1 =~ s/\t/\\t/g;
$str1 =~ s/\n/\\n/g;

print $str1; 
#it prints exactly the same
#1234\n\t5678

```