#!/usr/bin/perl use strict; use warnings; opendir( DIR, "D:/test_dir"); my @file_list = readdir(DIR); closedir(DIR); print "Decision whether it is a file or a directory:\n"; foreach ( @file_list ) { if( (-d $_) ) { print "directory: " . $_ . "\n"; } if( (-f $_) ) { print "file: " . $_ . "\n"; } } print "\n\n"; print "Just print everything:\n"; foreach ( @file_list ) { print $_ . "\n"; } #### Decision whether it is a file or a directory: directory: . directory: .. Just print everything: . .. abc appl asdf Copy of ignore.txt GpSw.chk ignore.txt vxos