in reply to Re^2: selcting all files in a given directory except......
in thread selcting all files in a given directory except......

Maybe the opendir is failing. Modify that line to read:
opendir (my $DIR, $dir) || die "Unable to open $dir: $!";

then try again.

Replies are listed 'Best First'.
Re^4: selcting all files in a given directory except......
by asdfghjkl (Initiate) on Dec 06, 2007 at 10:12 UTC
    this is the code which i hav been excecuting...... still unable to find out........
    #!/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"; }