in reply to run away ?
If your going to change $/ use local $/ = "new value";.
Your script won't loop forever, nor will a while loop. Your computer won't blow up either. :-)
Have a look at perlvar (search for $INPUT_RECORD_SEPARATOR) to get the full details.
Here's a test:
#!perl use 5.12.0; use warnings; local $/ = "1313"; while (<DATA>) { say qq{Found line: $_}; } __DATA__ qwerty qwerty qwerty qwerty qwerty qwerty
Which outputs:
$ strange_in_rec_sep.pl Found line: qwerty qwerty qwerty qwerty qwerty qwerty
Adding 1313 to the data:
__DATA__ qwerty qwerty qwerty 1313 qwerty qwerty qwerty
The output becomes:
$ strange_in_rec_sep.pl Found line: qwerty qwerty qwerty 1313 Found line: qwerty qwerty qwerty
Thanks for your amusing post. I had a good chuckle. :-)
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: run away ?
by toniax (Scribe) on Nov 06, 2010 at 21:06 UTC | |
by kcott (Archbishop) on Nov 07, 2010 at 02:37 UTC | |
|
Re^2: run away ?
by Jim (Curate) on Nov 07, 2010 at 21:12 UTC | |
by GrandFather (Saint) on Nov 07, 2010 at 22:49 UTC | |
by Jim (Curate) on Nov 08, 2010 at 01:42 UTC | |
by kcott (Archbishop) on Nov 08, 2010 at 04:56 UTC |