Those extra octets with (stat())[2] are filetype, sticky bit and others (or as you pose the question exactly the other way: the lower bits are the standard permission bits). Just mask them with and (and please consider using octals for readability, 33206 is more an illness than anything else).

If you've access to a unix box: man 2 stat; man 3 stat.

As you do have access to an ubuntu box: consider grepping the compiler includes (struct stat, field mode_t), they're authorative and quite often eye-opening (even if they tend to be in that wrong, lower language called C. Still that and the syscalls are the base for Perl).

:)
Peter

PS: missing is e.g. this
ls -ld . -> drwxr-xr-x 187 jakobi jakobi 16384 2009-10-05 18:56 .
which are the lower bits in the stat call.

ignore the leftmost d for now, and you've the 3*3 perm bits for user, group and other. Which probably are the bits accounting for most of the windows to linux difference in stat output. (please also ignore the output overload of the ls command, which just has to abose the x bit for things like hinting at the setgid or setuid bit, and worse - that's doesn't have anything to do with the bitfield from stat()). The 'd' from ls is used for a filetype of a dir, as with the test commands of test -d in the shell or Perl's -d. And this filetype is encoded in some of the higher bits returned by mask.


In reply to Re: POSIX::S_ISDIR() with $stat->mode values from Windows vs. Linux by jakobi
in thread POSIX::S_ISDIR() with $stat->mode values from Windows vs. Linux by isync

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.