#!/usr/sph/bin/perl5
 
my ($infile) = $ARGV[0];
open(IN, $infile);
open(OUT, "> /tmp/crap.gif");
while (<IN>) {
    print OUT if m#GIF87a#i .. m#^@;#i;
}