perlstring#

Quote a string as a Perl double-quoted string.

Synopsis#

my $code = XString::perlstring($str);
my $back = eval $code;        # eq $str

What you get back#

$str between double quotes, escaped so that perl reads it back as the same string: ", \, $ and @ are escaped, control characters take their backslash spelling or an octal escape, and a string of characters is written with \x{...} escapes. undef gives 0, unquoted. The same as B::perlstring.