in reply to hash parameter question

I can't reproduce this problem (%users seems to have the right value in the function) but there is a problem with the following:

foreach(keys %users) { my %user=$_; [...] }

$_ isn't a hash so it doesn't make sense to assign it to a hash variable. $_ is one of the hash keys returned by keys. What you want is this:

foreach my $username (keys %users) { #my $pw=getpwnam($users{$username}{uname}); # actually it's simpler, you already have the name... my $pw=getpwnam($username); my $homedir=$pw->dir; }

I also suggest that your build_quota_list return a reference to the hash it builds and find_deletion_candidates take this reference as input. Otherwise you are making a copy of the whole contents every time you pass it around.