in reply to Re: Binary Comparision
in thread Binary Comparision

How would I read the file other than into an array? Is there a way to access it a bit at a time? JP

Replies are listed 'Best First'.
Re^3: Binary Comparision
by ikegami (Patriarch) on Feb 28, 2007 at 00:12 UTC

    How would I read the file other than into an array?

    You can read the entire file into a scalar using the following snippet:

    my $raw_data; { local $/; $raw_data = <FH>; }

    Is there a way to access it a bit at a time?

    Yes, using read.

Re^3: Binary Comparision
by Zaxo (Archbishop) on Feb 28, 2007 at 03:22 UTC

    You can set $/ to a reference to a literal number. Then the file will be read in chunks of that size.

    { local $/ = \1024; while (<$fh>) { # do things with 1k chunks in $_ } }

    After Compline,
    Zaxo