http://www.perlmonks.org?node_id=612634

use warnings; opendir (DIR,'/home/props/new') or die "cant read $!\n"; while(($filename = readdir(DIR))) { next if $filename == '.' or $filename == '..' ; push @files , $_ ; } print @files;