in reply to Opendir error
I think you want something along the following lines:
A dir handle can only be read by readdir, not via the diamond <>. You probably want to exclude the . directory, so you have to escape the . in the regex and most probably you'd also prefer not to have .. either.use strict; opendir(DIR,".") or die("Can't open directory '$!'"); while (my $file = readdir(DIR)) { next if $file =~ /^\.{1,2}$/; print "$file\n"; } closedir(DIR);
Hope this helps, -gjb-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:x2 Opendir error (don't filter with a regex)
by grinder (Bishop) on Jan 17, 2003 at 14:24 UTC | |
by jdporter (Paladin) on Jan 17, 2003 at 16:36 UTC |