in reply to random file selection
...wufnikopendir( DIR, "." ) || die "Can't open DIRHANDLE, stopped"; -f $_ and !/^\./ and push @entry, "$_" while ($_ = readdir(DIR)); closedir( DIR ); @entry[-$i,$j] = @entry[$j,-$i] while $j = rand(@entry - $i), ++$i < @ +entry; map { print $_ . "\n" } @entry[0 .. ( shift || 1 ) - 1];
|
|---|