in reply to Re: foreach on array
in thread foreach on array

I was going to reply something similar when I read the original node. But then I started to wonder whether perhaps the OP was dealing with legacy code and a file that used Windows and Unix line terminators interspersed. For example:

data1\n data2\r\n data3\n ...etc
If this file were to be read in under Windows in a while loop, the first line would be
data1\ndata2\r\n
,no? (Can't check, I don't have access to a Windows machine.) In which case splitting on \n and then pushing the resulting array into another one ( as suggested by shenme above ) would make perfect sense (albeit a chomp would still be required). Or am I mistaken?