in reply to read directory
If you're planning to filetest the return values out of a readdir, you'd better prepend the directory in question.
Also, you should always check the return value of opendir. Moreover, use strict and warnings, they should tell you that $fh and $dh are different variables.
So, all of that together:
#!/usr/bin/perl use warnings; use strict; my $dir = 'C:/'; opendir my $dh, $dir or die $!; while (my $file = readdir $dh) { print "$file\n" if -d "$dir/$file"; } close $dh;
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: read directory
by Anonymous Monk on Dec 20, 2017 at 15:49 UTC | |
by choroba (Cardinal) on Dec 20, 2017 at 15:55 UTC | |
by Anonymous Monk on Dec 20, 2017 at 16:10 UTC |