Reg. Directory listing program

[email protected] ("Gunwant Singh")
Newsgroups perl.beginners
Message-ID <[email protected]>
Hi,

I am new to this mailing list and I am very new to PERL. So, please bear
with me for my questions.
I wrote a code that lists files in a directory with the permissions. I am
coding for MS-Windows.
Here is my code:

*1 use strict;
2 use warnings;
3 use File::stat();
4
5 opendir (DH, "subcode") or die "$!";
6 foreach my $file(readdir DH)
7 {
8 my $perm=stat($file)->mode;
9 print "$file\t$perm\n";
10 }
11 closedir (DH);

*I am getting the listing of file just fine if I dont add line 8. But as
soon as I try to display the permissions, I get this:

*Can't call method "mode" without a package or object reference at
C:\Documents a
nd Settings\Myself\Desktop\code\dir-op.pl line 8.

*What am I doing wrong!

Thanks.

-- 
Gunwant Singh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.