"Today we're going to take a brief introductory look at
Perl's stat() function and how you can use it to extract lots of
useful information from files, directories, etc (actually,
everything in Linux/Unix is a "file" of a certain type). It's
incredibly easy to use and, even if you've never used Perl before,
very easy to implement. If you're still stuck at the Shebang line
in point of reference to Perl/shell scripting, check out that post,
as we hope it provides a good base for one of the things you're
most likely to find in a Perl or shell script. It also goes beyond
just scripting and attacks some other basic concepts.
"Here's a very simple Perl script (which, as demonstrated, can
be written on the command line as well) that will let you know the
user id and group id associated with a particular file. We won't be
exploring stat() completely in this post. just enough to get you
started and comfortable (you could get the same information by
running "ls -l" instead of just "ls," but that would defeat the
purpose, right? ;):"
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.