Ok, I took the good image and looked at it in a hex editor...
Looks like your data is truncated, because the following
works
for me:
print "Content-type: image/gif\n\n";
print Image();
sub Image {
my $image =
'4749463839610f001000a2ff00848684' .
'dfe0dfc6c7c6c0c0c000000000000000' .
'000000000021f90401000003002c0000' .
'00000f00100040034048baacf3608049' .
'a98824ca0aae78d9b375a4164a92470e' .
'016a8dde10721c48dfc029ee528b0ac0' .
'e06717121a8132cd6729b4ed8cc4c891' .
'97a45a09b286569100003b00';
return(pack("H*",$image));
}
So the problem must lie in the unpack code.