Stat(function)

The purpose of the stat system call is to obtain details about a file object you are interested in. Details from the inode are returned (in a structure by the C function).

The details obtained are roughly those you would see using "ls -ld $fname" such as the file type, size, timestamps and so on.

stat has a related function lstat that does not follow symbolic links (hence lstat returns you data on the link rather than what it points to).

http://linux.die.net/man/2/stat

The same details are obtained in a list context by the Perl function. http://perldoc.perl.org/functions/stat.html