Re: 'safe' printing to the terminal

[email protected] ("Ruud H.G. van Tol" via perl5-porters) Mon, 11 May 2026 12:28:33 +0200
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On 2026-05-11 11:44, Michiel Beijen wrote:
 > I feel 'printing of untrusted output to the terminal' is something 
that should have a de-facto solution in core perl; would it be weird to 
want to have a 'standard' solution for this?

In bash there is "${var@Q}"


printf has %q:

   $  printf -v var "%q" "^[[4mtest^[[m"

   $  echo $var

   $  eval "echo $var"

-- Ruud