in reply to how to check permissions

The example given by draconis only provides the "owner/group/other" mode flags for the file in question. It looks like the OP was asking how to learn what sort of access is available to the person running the perl script.

In order to do that, you would need to combine the mode field from stat with knowledge of the current user's group membership(s) and whether the current user happens to be the owner of the file, so you'll know which set of bits from the mode flag are relevant for determining file access.

A better way for the task at hand would be:

($r,$w,$x) = (-r $path, -w _, -x _); print "Access: read $r, write $w, execute (search dir) $x\n";
A few notes: