in reply to my image is not showing

The browser doesn't know what to do with an inline image, and it doesn't expect another HTTP header.

What you have to do is to separate the script the prints out the chart from the one that prints the HTML. In the HTML you generate a link to the script that returns the image, and just the image + header:

# HTML generating script: use CGI; my $q = CGI->new(); print $q->header(), $q->start_html(), ... # Image generating script: use CGI; use GD::Graph::points; print "Content-Type: iamge/png\n\n"; # generate plot here ... binmode STDOUT; print $myimg->png;