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
.



Relevant Pages

  • Re: Help: Filemask problem
    ... Amy Lee wrote: ... I write a perl script to show the file mask like -rwxr-xr-x is 0755, ... | The gene pool could use a little chlorine. ...
    (comp.lang.perl.misc)
  • Help: Filemask problem
    ... I write a perl script to show the file mask like -rwxr-xr-x is 0755, ... if (@ARGV!= 0) ... Amy Lee ...
    (comp.lang.perl.misc)
  • Re: Help with search and replace
    ... Command line arguments to a Perl script are placed in the special ... array variable @ARGV. ... # Ouside the loop ...
    (comp.lang.perl.misc)
  • Re: Help: How to change PATH variable by array?
    ... On 08/26/2007 08:08 AM, Amy Lee wrote: ... I make a Perl script to add a path in PATH variable of the .bash_profile. ... This is not your real program. ... use strict; ...
    (comp.lang.perl.misc)
  • Re: Argument for perl script
    ... my @argv = @ARGV; ... my $icnt = 0; ... Now the requirement is that if I don't pass any argument to Perl script then ...
    (perl.beginners)