in reply to Problems with -filetest on readdir results
This is a great opportunity to use map especially if you are going to need the path again later in your script.
From your code Untested:
Update: Thanks merlyn#!/usr/bin/perl $path="."; opendir (DIR, $path) or die "could not open directory"; @files = map {"$path/$_"}, readdir(DIR); #maps the path into your arra +y foreach (@files) { print "$_ \n" if (-d $_) ; }
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: Problems with -filetest on readdir results
by merlyn (Sage) on May 24, 2002 at 03:14 UTC |
In Section
Seekers of Perl Wisdom