aboutsummaryrefslogtreecommitdiff
path: root/devel/p5-File-Random/pkg-descr
blob: 66fe3d509a1a38d7088f6de03d8eb2066465919f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
This module simplifies the routine job of selecting a random file. (As you
can find at CGI scripts).  It's done, because it's boring (and
error prone), always to write something like

  my @files = (<*.*>);
  my $randf = $files[rand @files];

or

  opendir DIR, " ... " or die " ... ";
  my @files = grep {-f ...} (readdir DIR);
  closedir DIR;
  my $randf = $files[rand @files];

It also becomes very boring and very dangerous to write randomly selection
for subdirectory searching with special check-routines.  The simple
standard job of selecting a random line from a file is implemented, too.