in reply to How to eliminate text portion of a binary file?

Are there a fixed number of them? Are the lines of fixed length? The thing about "binary" data is that anything goes: any value is valid. So, the more we know about your header, the better equipped we are to help...

thor

  • Comment on Re: How to eliminate text portion of a binary file?

Replies are listed 'Best First'.
Re: Re: How to eliminate text portion of a binary file?
by Anonymous Monk on May 14, 2004 at 20:48 UTC
    The header will always end with the line:

    #### end_ascii_header

    Thanks,

    -fiddler42

      Try this, then:
      use strict; use warnings; open(my $fh, "/path/to/file") or die $!; while(<$fh>) { last if $_ eq "#### end_ascii_header\n"; } #$fh is now positioned at the beginning of the binary data; do what yo +u will

      thor

      Update:Fixed a typo in the code (missing 'if')