Hi, Charlie! Fancy seeing you here.
The problem is probably how you are reading the gif. Since
gif data is binary, you can't use the <INFILE> input operator.
You need to use the 'read' statement.
read(HANDLE, VARIABLE, LENGTH, POSITION);
This will do what you want:
@filelist = `ls *.gif`;
foreach $file (@filelist) {
chomp($file);
open(INFILE, $file);
$bytes = -s $file;
$num_bytes = read(INFILE, $contents{$file}, $bytes, 0);
print "$file had $num_bytes\n";
$unique{$contents{$file}}++;
}
while(($tag, $value) = each(%unique)) {
$outfile = "unique/unique$i.gif";
open(OUTFILE, ">$outfile") ||
die "Problem with $outfile";
print OUTFILE $tag;
close(OUTFILE);
$i++;
}
-------------------
Season to taste, of course.
--Jimbo (Bomis)