CGI Random Image

Random Image

#!/usr/local/bin/perl

@URL = ("http://www.example.com/1.jpg",
        "http://www.example.com/2.jpg",
        "http://www.example.com/3.jpg",
        "http://www.example.com/4.jpg");

srand (time | $$);

$number_of_URL = $#URL;
$random = int (rand ($number_of_URL));

$random_URL = $URL[$random];

print "Content-type: text/html", "\n\n";
print qq|<img SRC="$random_URL">|, "\n";

exit (0);