Bindo has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I just want to learn how to work with hashes within subroutines. For an instance say that I want to get all the users whos ids are greater than 500 from /etc/passwd file and list thier home directories in the following manner

dave --> /x02/dave

jack --> /x02/jack

Following script would only print information pertaning to one user.
my %UID_PATH; my %ARR1 = uid(); foreach my $TAB (keys %ARR1) { print "User --> $TAB, Value --> $ARR1{$TAB}\n"; } sub uid { my %UID_PATH; open (FH1, "</etc/passwd") || die "Can't Open : $!"; while (<FH1>) { my %UID_PATH; my @UID = split (/:/, $_); if ($UID[2] > 500) { my $USER = "$UID[0]"; %UID_PATH = ("$USER" => "$UID[5]"); #print "$USER --> $UID_PATH{$USER}\n"; return %UID_PATH; } } }

Please can someone help me out. I just want to to display all users with a UID greater than 500. Still main rational here is to understand hash behavior in subs. :)