
Paul
Enthusiast
Aug 27, 2002, 4:29 AM
Views: 2453
|
Re: [l008com] Random Code Swapper...
|
|
|
•Take a predefined folder •Choose a random item in that folder •read the contents of that item, and spit it to the screen
my $dir = '/a/b/c'; my @files = (); opendir DIR, $dir or die "Can't open dir $dir : $!"; @files = grep { !/^\./ } readdir(DIR); closedir DIR; open FILE, $files[rand @files] or die "Can't read file: $!"; read FILE, my $string, -s FILE; close FILE; print "Content-type: text/html\n\n"; print $string;
(This post was edited by RedRum on Aug 27, 2002, 4:31 AM)
|