in reply to Re: converting stat() $mode to unix file permissions
in thread converting stat() $mode to unix file permissions

Note that in the example, the $unixmode will come out in decimal mode. You may therefore prefer to use the following code to convert the output to the more common octal format:

$unixmode = sprintf("04%o", (stat $filename)[2] & 07777)