print "Content-type: text/htlp\n\n"; $n=1; @files = glob("random/*.html); fisher_yates_shuffle(@files); # see the Perl Cookbook for this function foreach $file (@files) { ... }