Nishi Bhonsle wrote: > > I got the last soln, ie to use File::Basename module. Please ignore the > last thread. > > I am still interested to know why Rob's soln doesnt work for me?
So was I, and it's because I made a mistake. Because the values returned by readdir don't include a full path, the file test only works if the directory being listed is the current one. Try this version instead with my humble apologies. Rob use strict; use warnings; my $path = 'C:\build\Sample\NewDir'; my @dir = do { opendir my $dh, $path or die $!; grep -f "$path\\$_", readdir $dh; }; print "$_\n" foreach @dir; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>