in reply to selcting all files in a given directory except......
After the readdir there is a stray closing parenthesis.
#!/usr/bin/perl use strict; use warnings; chomp(my $dir = <STDIN>); my @files; if (-d $dir){ opendir (my $DIR, $dir); @files = grep { m/^(?!\.{1,2}\z)/ } readdir($DIR); closedir($DIR); } foreach my $file (@files) { print "$file\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: selcting all files in a given directory except......
by Anonymous Monk on Dec 06, 2007 at 09:29 UTC | |
by moritz (Cardinal) on Dec 06, 2007 at 09:32 UTC | |
by Anonymous Monk on Dec 06, 2007 at 09:38 UTC | |
| |
| A reply falls below the community's threshold of quality. You may see it by logging in. |