![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: Retunining hash values from subroutinesby kcott (Archbishop) |
on Jun 20, 2013 at 21:21 UTC ( #1040030=note: print w/replies, xml ) | Need Help?? |
G'day Bindo, You seem to have your answer with respect to "... main rational here is to understand hash behavior in subs.". This is additional information, regarding your example code, which you may find useful. Here's a much more succinct way to generate the output you want:
In addition to getpwent() (which iterates through all records), there's also getpwnam() (which returns a single record based on username), getpwuid() (which returns a single record based on numeric user ID) and other related functions. While the online documentation (Fetching user and group info) lists these functions, it provides little in the way of details (return values are not even shown). For that, you can use:
-- Ken
In Section
Seekers of Perl Wisdom
|
|