in reply to Re^3: selcting all files in a given directory except......
in thread selcting all files in a given directory except......
#!/usr/bin/perl use strict; use warnings; chomp(my $dir = <STDIN>); my @files; if (-d $dir){ opendir (my $DIR, $dir) || die "Unable to open $dir: $!"; @files = grep { m/^(?!\.{1,2}\z)/ } readdir($DIR); closedir($DIR); } foreach my $file (@files) { print "$file\n"; }
|
|---|