I call it like this: my %users=build_quota_list; It seems to work fine; I've verified with the debugger that my nested hash contains what I expect it to contain. However, when I try to pass that selfsame has into a subroutine, all hell breaks loose.sub build_quota_list { my %users; open QUOTA, $quotareport; while (<QUOTA>) { if (m/ \+[ \-]/) { my ($username, $over, $used, $soft_block, $hard_block, $junk) +=split " ", $_, 6; $users{$username}{uname}=$username; $users{$username}{used}=$used; $users{$username}{soft_block}=$soft_block; $users{$username}{hard_block}=$hard_block; } } close QUOTA; return %users; }
sub find_deletion_candidates { my %users=@_; use User::pwent; foreach(keys %users) { my %user=$_; my $pw=getpwnam($user{uname}); my $homedir=$pw->dir; } # do bunch o' stuff I haven't coded yet return %users; } %users=find_deletion_candidates(%users);
It's really wierd. With the debugger (ptkdb), I can verify that @_ looks like I'd expect, my nice nested hash. But after I do my %users=@_, %users doesn't contain what I expect. What am I doing wrong?
Thanks a ton,In reply to hash parameter question by PerlHeathen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |