in reply to perl in DOS woes

I used read, and then switched to sysread. It was the binmode that escaped me. I'll also have to try the other stuff, although the data isn't delimited at all. It's one big block of contiguous samples packed together. I have to know the size of each sample and handle the parsing from there (I didn't create the format... just have to deal with it). Thanks for the help. I'll give it a try in the morning.

Replies are listed 'Best First'.
Re: Re: perl in DOS woes
by BrowserUk (Patriarch) on Nov 05, 2002 at 06:17 UTC

    From your description, unpack would be perfect for your purposes.

    For example, if your file has 3 16-bit integers, 2 32-bit integers and 4 1-byte ascii fields, getting them into seperate scalars would be as simple as

    my ($int16_1, $int16_2, $int16_3, $int32_1, $int32_2, $c_1, $c_2, $c3, + $c_4) = unpack'S3 L2 C4', $scalar_18_bytes;

    And there are format specifiers for just about every conceivable sort of datatype, size and -endian that you are likely to encounter.


    Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy