I am not sure I fully understand what you are trying to do - and in which framework you are trying to do it. My guess, however, would be that you have a typical end-of-line type of problem.
Could it be that your are using data from different operating systems including Windows? Remember that the line break in Linux is \n while unser Windows it is \n\r.
Removing just one type of line breaks from a file containing mixed line break types may therefore result in unpredictable results. I have had this kind of problems many times myself (in fact, you may want to have a look at one of my earlier posts).
Hope this helps.
Cheers -
Pat
Comment on Re: how to read data for every 280 character ?
would be that you have a typical end-of-line type of problem. $/=280; means readline reads 280 bytes at a time, not lines (so line-ending characters don't matter).
C:\>perl -e"die unpack q~H*~, $/"
0a at -e line 1.