[comp.unix.questions] Separator frobs

schwartz@cs.psu.edu (Scott Schwartz) (01/20/90)

Larry writes:
>$/ = "\0";				# line sep is something non-existent

You know, I've always kind of disliked doing that. Suppose your file
contains all possible byte values 0..255?  Something loses. Maybe doing
something like ``undef /;'' to make ``$/'' undefined could be used to
tell perl to just read the whole thing.  (Undefined is different from
the null string, right?)

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/23/90)

In article <Ckvp5d1@cs.psu.edu> schwartz@cs.psu.edu (Scott Schwartz) writes:
: Larry writes:
: >$/ = "\0";				# line sep is something non-existent
: 
: You know, I've always kind of disliked doing that. Suppose your file
: contains all possible byte values 0..255?  Something loses. Maybe doing
: something like ``undef /;'' to make ``$/'' undefined could be used to
: tell perl to just read the whole thing.  (Undefined is different from
: the null string, right?)

Right, though the incantation would be "undef $/;".

If you are in that situation, then it's easier just to say

	read(STDIN, $_, 1000000000);

No doubt you'll now complain that you have a file larger than a gigabyte...  :-)

However, your idea has merit (in particular because the above won't read
from <>).  In fact, I just implemented it.  Thanks.

Larry