As
Mr. Muskrat suggests, this is more to do with your appreciation of web server layout and permissions than Perl. If I run your script right here and then
tail the error.log, I get:
[Sun Nov 2 06:36:56 2003] [error] [client 127.0.0.1] file permissions
+ deny server execution: /usr/lib/cgi-bin/image.png
If, however, I modify the open line to write a file in the document root and, in the HTML section, change the img src to look like this:
<img src="/image.png" alt="a red circle" />
...I get a red circle, which I guess is what you are after.
MB