How can I manually interpolate string escapes in a Perl string?

后端 未结 2 640
谎友^
谎友^ 2020-11-29 13:31

In perl suppose I have a string like \'hello\\tworld\\n\', and what I want is:

\'hello  world
\'

That is, \"hello\", then a li

2条回答
  •  伪装坚强ぢ
    2020-11-29 14:10

    Sounds like a problem that someone else would have solved already. I've never used the module, but it looks useful:

    use String::Escape qw(unbackslash);
    my $s = unbackslash('hello\tworld\n');
    

提交回复
热议问题