Re: 'safe' printing to the terminal

[email protected] ("Ruud H.G. van Tol" via perl5-porters) Mon, 11 May 2026 18:20:26 +0200
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On 2026-05-11 17:34, Michiel Beijen wrote:
 > On Monday, May 11th, 2026 at 12:29, "Ruud H.G. van Tol" via 
perl5-porters <[email protected]> wrote:
 >
 >> printf has %q:
 >>
 >>    $  printf -v var "%q" "^[[4mtest^[[m"
 >>    $  echo $var
 >>    $  eval "echo $var"
 >
 > Yeah, that does what I want, but unfortunately this is not available 
in _perl_ printf, only in _bash_ printf.
 >
 > Still looking for advise on how to print 'untrusted' input to a TTY 
in a way that is sane!

This was about the shell's printf, not about Perl's printf.

What stops you from using it?

-- Ruud