
Paul
Enthusiast
Aug 27, 2002, 4:29 AM
Post #3 of 5
(2452 views)
|
Re: [l008com] Random Code Swapper...
[In reply to]
|
Can't Post
|
|
•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)
|