How can I print a string (single-quoted) containing double-backslash \\\\
characters as is without making Perl somehow interpolating it to single-slash \\
The only quoting construct in Perl that doesn't interpret backslashes at all is the single-quoted here document:
my $string1 = <<'EOF';
a\\\b
EOF
print $string1; # Prints a\\\b, with newline
Because here-docs are line-based, it's unavoidable that you will get a newline at the end of your string, but you can remove it with chomp
.
Other techniques are simply to live with it and backslash your strings correctly (for small amounts of data), or to put them in a __DATA__
section or an external file (for large amounts of data).