open my $file "<", $image_file or die "grr: $!"; # (You shouldn't print the header manually if you use CGI) print "Content-type: image/gif\n\n"; print $_ while <$file>;