use strict; use warnings; use CGI; use CGI qw(:all); my $q = CGI->new; print $q->header(-type=>'image/gif', -charset=>'UTF-8'); print $q->start_html(-title=>'testgif', -author=>'test@test', ); open(my $F, '<', '1.gif') || die "can not open\n"; local $\ = undef; print <$F>; close($F); print $q->end_html;