Guys im trying to see the permission of a certain file in perl using stat.
So when i did this
foreach (@original_files) {
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev,
$size, $atime, $mtime, $ctime, $blksize, $blocks) = stat ($_);
print "$mode \n";
}
this outputs:
33204 which corresponds to the permission -rw-rw-r--
which i cant understand why is it 33204. <-- This is my first question
Next is i tried converting the $mode to octal which i know is the number system for umask.
this is my code:
printf ("%0\n",$mode);
now this outputs 100664 which i quite undersand the last 3 digits (rw-rw-r--) but i dont understand where did the first 3 digits come from ( the 100 in the 100664) That is my second question
Lastly is i tried this code again:
printf ("%o\n", $mode & 775); #im not sure about the 775, or is it 577
That last code is what i desired. It outputs 664. And my question is why when i AND the $mode to i forgot the value (775 or something) it outputs the right permission.?
And OT question too: What is the difference of $_ and @_?