use strict; use warnings; my $dir = shift @ARGV; # Get first command line argument opendir DIR, $dir or die $!; # Open Directory for my $file ( readdir(DIR) ){ # Loop through reading each file print "$file \n"; }