in reply to Re: Changing quoted strings spanning more than one line
in thread Changing quoted strings spanning more than one line

I wonder how the $1 =~ tr/\n// in your solution doesn't die with "modification of a readonly value attempted"?
This special form of tr with an empty replacement list is used to count the number of characters. Example from perlop:
$cnt = tr/0-9//; # count the digits in $_
In perlfaq4, they give an example indicating that this idiomatic use of tr is the canonical Perl way to count the number of characters in a string. Admittedly, apart from these examples, I can't find an explicit statement in the docs that this special form of tr does not attempt to modify the string.

Replies are listed 'Best First'.
Re^3: Changing quoted strings spanning more than one line
by shmem (Chancellor) on Sep 19, 2007 at 20:15 UTC
    Um, it's so long ago that I read the faq... thanks for the clarification.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}