#!/usr/bin/perl -w
my @sb = stat "/etc/passwd";
my $userid = $sb[4];
my @pwent = getpwuid $userid;
my $username = $pwent[0];
print "/etc/passwd is owned by $username\n";
$ /tmp/foo.pl
/etc/passwd is owned by root
Руководство perldoc perlfunc
содержит много информации об этих семействах функций.