Re: Help: Filemask problem



On Sun, 14 Oct 2007 19:44:35 +0800, Amy Lee wrote:

Hello,

I write a perl script to show the file mask like -rwxr-xr-x is 0755, but
when I run my script, it shows 835 in this mode. I don't know why.

There's my code:

#!/usr/bin/perl -w

if (@ARGV == 0)
{
die "Usage: filemask.pl <filename(s)>\n";
}
}
if (@ARGV != 0)
{
foreach $file (@ARGV)
{
unless (-e $file)
{
print "***Error: $file dose not exist.\n"; next;
}
unless (-r $file)
{
print "***Error: Cannot read $file.\n"; next;
}
my($mode) = stat($file);
print "$file ==> $mode\n";
}
}
}
Could you tell me how to solve this?

Thank you very much~

Regards,

Amy Lee

I change this part:

my($mode) = stat($file); to

my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime,
$ctime, $blksize, $blocks) = stat($file);

However, it's useless, what happened?

Thanks,

Amy Lee
.