Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Unix and Windows CRLF vs LF

by SavannahLion (Pilgrim)
on May 13, 2009 at 06:19 UTC ( [id://763679] : note . print w/replies, xml ) Need Help??

in reply to Re: Unix and Windows CRLF vs LF
in thread Unix and Windows CRLF vs LF

Ooops!! I meant to write While, rather than for each. I don't think for each in my code even works properly as it is written. I will update and make note.

On a side note, why is For Each less efficient than While? Aren't they the same in this context?

Thanks for your patience.

Replies are listed 'Best First'.
Re^3: Unix and Windows CRLF vs LF
by nikosv (Deacon) on May 13, 2009 at 07:06 UTC
    foreach will make a list out of the file's contents and then will iterate, so it will read the whole file into memory. while has a small footprint since it goes through the contents line by line plus it terminates when the the condition will evaluate to false;with foreach you go through everything in the list