in reply to Re: how to open a data file via http
in thread how to open a data file via http
You incorrectly defined a file as "a series of lines seperated by newlines", whereas it's really "a series of lines ending in newlines (except possibly the last one)".
split(/\n/, $data) doesn't work. It removes blank trailing lines.
split(/\n/, $data, -1) doesn't work either. It adds a blank line.
split(/^/m, $data, -1) works. Bonus: It doesn't remove the newline!
The last one can also be written as split(/^/m, $data) and special handling allows split(/^/, $data) to work too.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to open a data file via http
by pKai (Priest) on Feb 27, 2007 at 15:26 UTC | |
by ikegami (Patriarch) on Feb 27, 2007 at 16:39 UTC | |
by pKai (Priest) on Feb 27, 2007 at 17:31 UTC |