Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Parsing multiline string line by line

by ikegami (Patriarch)
on Feb 19, 2009 at 14:40 UTC ( [id://745066]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Parsing multiline string line by line
in thread Parsing multiline string line by line

split /\n/ and split /^/ both run fine on Windows and old Macs, for two different reasons

In Windows, the CRLF gets converted to LF on read, so there's no CR in the string to split.

In old Macs, \n is redefined to CR.

If you meant there would be problems parsing files from one system on a different system, you need to add unix files to the list.

[split /^/] works just like while (<>)

Indeed. It keeps the trailing newlines, and it keeps trailing blanks lines. split /\n/ does neither.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://745066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found