in reply to Re^7: File::Random module (McA)
in thread File::Random module
The following crawls a directory and prints out random file names. Each file has a 1 in 10 chance of being selected.
use PIR; my $iter = PIR->new->file->iter($somedir); while (defined(my $file = $iter->())) { next if int rand 10; print $file, "\n"; }
|
|---|