On Dec 5, 2006, at 2:35 PM, Daniel Linder wrote:
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
Yes sir. Nice demo!
So, it appears that the "$/" variable does keep the \n characters and doesn't treat them as special anymore.
Well, I live in a Linux/AIX universe so for me $/ is "\n" by default. If I change it to "||||" then "\n" is not special anymore. :)
"perldoc perlvar" talks about $/ and all the other special vars at length.
j