in reply to Re^4: input special characters
in thread input special characters
You're welcome! *tips hat* My anonymous brother's solution from Re: input special characters will do that:
chomp(my $sep = <>); my $sep = eval "qq/$sep/"; say join $sep, @data;
That said, as he also points out, this has its own set of risks, so weight the benefits carefully and decide whether you can trust your users. Using eval on user-supplied strings is generally a Bad Idea™.
A quick CPAN search finds String::Unescape, which avoids these problems and also keeps you from having to do your own unescaping:
use String::Unescape; # ... chomp(my $sep = <>); $sep = String::Unescape->unescape($sep); say join $sep, @data;
|
|---|