in reply to How do I search this binary file?

You've gotten plenty of good suggestions for the processing. I have one to add on the size of chunk to read. In list context, the stat call returns a preferred block size at index eleven.

sub strings_from_bin { my ($file, $dlim) = @_; local *BIN; open BIN, "< ".$file or die $!; binmode BIN; local $/ = \(stat BIN)[11]; my @strings; # ... populate @strings from <BIN> close BIN or die $!; @strings; }

Update: I believe that the block size on fat filesystems can vary, but I have been unable to track down a way of reading it. I seem to recall that 4k and 32k were popular. Can anyone more familiar with win32 help?

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: How do I search this binary file?
by John M. Dlugosz (Monsignor) on Aug 21, 2002 at 15:10 UTC
    I've never noticed those fields before.

    Hmm, on Win32 stat only returned 11 elements, not 13.

    Found "Platforms that do not have rdev, blksize, or blocks will return these as '', so numeric comparison or manipulation of these fields may cause 'not numeric' warnings."

    So, it should really be something like: $blocksize= (stat BIN)[11] || 2048;