trek1s has asked for the wisdom of the Perl Monks concerning the following question:
How can I get the owner name (not only uid) of a file with perl? With stat() function I can retrieve both uid and gid but not the user name, so before starting to reinvent the wheel I'd like to know if there is a simpler way.
Thanks in advance.
Solution: $owner = getpwuid((stat($file))[4]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to get file owner name?
by moritz (Cardinal) on Sep 10, 2007 at 08:55 UTC | |
by trek1s (Scribe) on Sep 10, 2007 at 09:47 UTC | |
by narainhere (Monk) on Sep 10, 2007 at 11:01 UTC | |
by Fletch (Bishop) on Sep 10, 2007 at 12:51 UTC | |
by grinder (Bishop) on Sep 10, 2007 at 15:41 UTC | |
by trek1s (Scribe) on Sep 10, 2007 at 12:13 UTC |