in reply to Retunining hash values from subroutines

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:

$ perl -Mstrict -Mwarnings -le ' while (my @pwent = getpwent()) { next if $pwent[2] <= 500; print join " --> ", @pwent[0,7]; } ' ... ken --> /Users/ken ...

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:

perldoc -f getpwent

-- Ken