in reply to GD graphs and CGI

You are saving your PNG both to an image file (file.gif, which has the wrong extension, it should be file.png) and printing it to STDOUT, where it gets sent to the browser.

If you want to send your image directly to the browser, then you'll need to send it to STDOUT with a proper content-type header:

print "Content-type: image/png\n\n"; print $gd->png;

If you want to save the image on your server and tell the browser to display it, then use:

open IMG, '>file.png'; print IMG $gd->png; close IMG; print "Content-type: text/html\n\n"; print '<img src="http://yourserver.com/file.png">';

UpdateFixed typo in content-type.