in reply to Automatically creating incremental file names

Perl Cookbook item 7.5: Creating Temporary Files.

use IO::File; use POSIX qw(tmpnam); my $name; do{ $name = tmpnam() } until $fh = IO::File->new( $name, O_RDWR|O_CREAT|O_EXCL ); binmode $fh;

Use $fh as the file handle, instead of IMG

Don't forget to change the file name in the <IMG SRC= .. print statement. You'll need some way to delete old files every once in a while.