gaurav has asked for the wisdom of the Perl Monks concerning the following question:
Hi,I am very new to PERL.I have been confusing so far regarding directories.I mean,suppose if I run the below code
#!/usr/bin/perl use warnings; use strict; opendir DH, "." or die "couldn't ope $!"; while ($_ = readdir(DH)) { next if $_ eq "." or $_ eq ".." ; print $_, " " x (30 - length($_)); print "d" if -d $_; print "r" if -r _; print "w" if -w _; print "x" if -x _; print "o" if -o _; print "\t"; print -s _ if -r _ and -f _; print "\n"; }
I am getting proper output as file-names ,permission and their sizes. But whenever I had change "opendir" as
opendir DH, "/home/gaurav/Documents" or die "couldn't open: $!";I have been getting only file-names,neither permissions nor file-size. Any-one can help me regarding this.Thanks in Advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Permission & size are not visible
by Corion (Patriarch) on Jun 19, 2013 at 06:56 UTC | |
by gaurav (Sexton) on Jun 19, 2013 at 09:03 UTC | |
by Corion (Patriarch) on Jun 19, 2013 at 09:05 UTC | |
by gaurav (Sexton) on Jun 19, 2013 at 09:33 UTC | |
by smls (Friar) on Jun 19, 2013 at 09:39 UTC | |
by gaurav (Sexton) on Jun 19, 2013 at 10:09 UTC |