Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Think about Loose Coupling
 
PerlMonks  

Re^3: Problem with files read to array split on empty lines

by tobyink (Abbot)
on Aug 03, 2012 at 06:37 UTC ( #985164=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Problem with files read to array split on empty lines
in thread Problem with files read to array split on empty lines

How did you transfer them? FTP? Many FTP clients will choose to transfer some files (often using the file name as a hint as to whether it's appropriate) in "ASCII mode" which means that it will change the line to the standard line endings for the local system during transfer.

Try replacing your /\n{2,}/ regular expression with:

/(?:\r?\n|\r){2,}/

... which should match two or more occurrences of any common line ending.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^3: Problem with files read to array split on empty lines
Select or Download Code
Re^4: Problem with files read to array split on empty lines
by jhoop (Acolyte) on Aug 03, 2012 at 19:12 UTC

    Tobyink, thank you. The files were downloaded through the server's cPanel web UI. After your initial reply i made a attempt at such a regex but my eyes were starting to glass over. I will try your suggestion and report back, although currently the server appears to be down :/ I would have thought that changing $/ to the empty string would have caught all instances of an empty line (as has been suggested in other nodes) but clearly I'm missing something.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-04-17 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (439 votes), past polls