[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] FWD: FIXME, July 2001



Jay Hannah wrote:
> Justin: Remember this? Scary, huh?
[...snip...]
> 1.1  (jhopkins 30-Jul-01):     $/ = '||||'; # FIXME?
> 1.1  (jhopkins 30-Jul-01):     my $errmsg = <$readfh>;

So, what does the FIXME line do?

>From "http://www.kichwa.com/quik_ref/spec_variables.html";, it says the
"$/" variable contains...:
    The input record separator, newline by default.
    $/ may be set to a value longer than one character
    in order to match a multi-character delimiter. If
    $/ is undefined, no record separator is matched,
    and <FILEHANDLE> will read everything to the end
    of the current file.

So, If I read it right, this causes the next line to continue reading from
the file $readfh, and put all characters up to but not including four
'pipe' symbols, right?

I.e. if the $readfh file handle pointed to a file whose contents was this:
This is line 1\n
this is line 2\n
this is line 3||||This is the beginning of a new "record"\n
This is really on line 4\n||||This is the end of the file.

Then, the first time $readfh is used, the $errmsg variable contains:
"This is line 1\nthis is line 2\nthis is line 3"

The next time, it would contain:
"This is the beginning of a new "record"\nThis is really on line 4\n"

And finally, it would contain:
"This is the end of the file."

If I understand this, the kicker here is that the "\n" characters are also
placed into the $errmsg variable.

Correct?

Dan

- - - -
"Wait for that wisest of all counselors, time." -- Pericles
"I do not fear computers, I fear the lack of them." -- Isaac Asimov