http://www.perlmonks.org?node_id=1027688


in reply to Making escape (\) ordinary in double quotes

sprintf does not alter the interpolation behavior of a double-quoted string, but it does provide all the interpolation capability of double-quoting – and more! See the many format specifiers in the docs.

>perl -wMstrict -le "my $foo = 'Foo'; my $bar = 'Bar'; ;; my $x = sprintf 'ignore \slash, expand %s, %s.', $foo, $bar; print qq{'$x'}; " 'ignore \slash, expand Foo, Bar.'