[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] FWD: FIXME, July 2001
On Nov 21, 2006, at 8:49 AM, Daniel Linder wrote:
> 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?
On Sun, December 3, 2006 12:03, Jay Hannah wrote:
> Exactly. We have a vendor sending us gobs of ASCII goo and in some
> cases the delimiter in a constant ASCII stream is '||||'. Fun, huh? :)
Later, Daniel Linder wrote:
> If I understand this, the kicker here is that the "\n" characters
> are also placed into the $errmsg variable.
Later, Jay Hannah wrote:
> They never send us "\n" characters. It's a 1 line stream of ASCII goo
> they send for months and months on end.
>
> Oh... On your hypothetical I'd have to write a little test program to
> see if you're right or not. :) Want me to do that?
No need, I did it here:
$ cat -n TestData
1 This is a test||||This is a second test||||This
2 is a
3 test again||||This is the last test
$ cat -n ParseTestData.pl
1 #!perl
2 $/ = '||||';
3 printf ("Got a line: %s\n",$_) while (<>) ;
$ perl ParseTestData.pl < TestData
Got a line: This is a test||||
Got a line: This is a second test||||
Got a line: This
is a
test again||||
Got a line: This is the last test
So, it appears that the "$/" variable does keep the \n characters and
doesn't treat them as special anymore.
Dan
- - - -
"Wait for that wisest of all counselors, time." -- Pericles
"I do not fear computers, I fear the lack of them." -- Isaac Asimov
"Soon we will be able to harness the rotational energy from Orwell's grave
to solve all world energy problems." -- /. user GigsVT (208848)
GPG fingerprint:6FFD DB94 7B96 0FD8 EADF 2EE0 B2B0 CC47 4FDE 9B68