http://www.perlmonks.org?node_id=1035100


in reply to About $/

No, because, as perlvar says, “the value of $/ is a string, not a regex.” — and a string can hold only one value at a time.

Perhaps you can proceed in this way: Pick one of the two end-line strings (say, \r) and assign it to $/. Then, split each line on the other end-line character (\003) and process each string as a “line.”

Or, if your file isn’t too big, you can slurp it all into memory and then split using a regex:

19:55 >perl -MData::Dump -wE "my $s = qq[fred\rwilma\003barney\rbetty\ +003]; my @lines = split /\r|\003/, $s; dd @lines;" ("fred", "wilma", "barney", "betty") 19:56 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,