use strict; use CGI; my $q = CGI->new(); my $image = $q->param("image") or ''; if($image ne ''){ print $q->header("image/gif"); ## print out the rest of image here } else{ print $q->header(); print $q->start_html("This is my page!"); ## print out HTML here... }