in reply to how to read data for every 280 character ?

So what kind of data are you trying to read? (The 280 sounds very familiar to me.)

Like anonymous monk suggests open the file in binmode. In fact it doesn’t harm to always do this.

You could for example read the bytes (skipping the new lines) and count the number of bytes you have read. So you read byte for byte with a while loop and when you encounter a new line you use a next to continue with the next iteration.

HTH

  • Comment on Re: how to read data for every 280 character ?

Replies are listed 'Best First'.
Re^2: how to read data for every 280 character ?
by bh_perl (Monk) on Aug 18, 2008 at 07:59 UTC
    
    Its Huawei NGN data.. do you familiar with it ?
    Actually it is a binary data...
    
    i used xxd command first to convert from bin to hex then i used perl to read the data..
    
    is it a good idea ?
    
    
      Don't bother using xxd. Perl can read in binary files just fine if you use binmode.
        How to read binary file using perl ?