Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by jhoop (Acolyte)
on Aug 03, 2012 at 06:05 UTC ( #985159=note: print w/ replies, xml ) Need Help??


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

I believe so but I can't say for sure. The copies on server are the originals, I pulled them to the home machine to test them after the script didn't work as expected. Windows does claim two of them are slightly less (-.01k) in size.


Comment on Re^2: Problem with files read to array split on empty lines
Re^3: Problem with files read to array split on empty lines
by tobyink (Abbot) on Aug 03, 2012 at 06:37 UTC

    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'

      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://985159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2014-10-23 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (129 votes), past polls