use Scalar::Quote qw(quote); $x = "\t"; print quote($x), "\n";