if statement - Perl, how to choose a directory -


i'm trying determine of content of folder directory , file, wrote following result not expect:

opendir dh, $dir or die "cannot open dir: $!"; @dirs = grep !/^\.\.?$/, readdir dh ; foreach $files (@dirs) {     print $files."<br>";     if ( -d $files )      {         print $files." directory<br>";     } } closedir dh; 

the result example below:

.file1 file.log file3.zip file4 file5.zip dir1.name1.suffix1.yyyy.mm.dd.hh.mm.ss file5.zip file6.tar dir2 dir3.name1.suffix1.yyyy.mm.dd.hh.mm.ss 

where item starting dir actual directory, question why if failing discover them such? doing wrong?

$diris missing...

if ( -d "$dir/$files" )     {         print $files." directory<br>";     } 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -