Have you tried your input? It works fine for me. As $_ isn't chomp()'d, it escapes the problem of modifying a readonly $1.
-sauoq
"My two cents aren't worth a dime.";
| [reply] |
Have you tried your input?
Yes I tried the input.
I test everything before I post it here. I have a test directory full of files called file, file1, file2, numfile, bigfile, blankfile, etc.
Nevertheless, it is difficult to test for every eventuality. It looks like the behaviour changes between 5.6 and 5.8:
$ perl5.005_03 -ne '$$_++||print' infile
here
comes
trouble
Modification of a read-only value attempted at -e line 1, <> chunk
+ 4.
$ perl5.6.1 -ne '$$_++||print' infile
here
comes
trouble
Modification of a read-only value attempted at -e line 1, <> chunk
+ 4.
$ perl5.8.0 -ne '$$_++||print' infile
here
comes
trouble
1
2
--
John.
| [reply] [d/l] |
Yes I tried the input.
Good. I thought you would have. I've learned to expect you to be rigorous. That's why I asked; I was surprised when it worked for me. I guess I should have known it was a version thing... now it all makes sense. :-) I'll update "my" solution, which really isn't "mine" at all, to reflect that.
Thanks, John.
-sauoq
"My two cents aren't worth a dime.";
| [reply] |