use strict; use warnings; my $dir = shift || '.'; my @rand; while (<$dir/*>) { push @rand,$_ if int rand 2 and -f $_; } print $_,$/ for @rand;