PerlHeathen has asked for the wisdom of the Perl Monks concerning the following question:
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,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash parameter question
by Celada (Monk) on Dec 12, 2005 at 22:47 UTC | |
|
Re: hash parameter question
by GrandFather (Saint) on Dec 12, 2005 at 22:51 UTC | |
|
Re: hash parameter question
by chas (Priest) on Dec 12, 2005 at 22:57 UTC | |
by ikegami (Patriarch) on Dec 12, 2005 at 23:09 UTC | |
by jarich (Curate) on Dec 13, 2005 at 02:43 UTC | |
by PerlHeathen (Initiate) on Dec 14, 2005 at 19:12 UTC | |
|
Re: hash parameter question
by tphyahoo (Vicar) on Dec 12, 2005 at 22:48 UTC | |
by chromatic (Archbishop) on Dec 12, 2005 at 23:04 UTC | |
by tphyahoo (Vicar) on Dec 13, 2005 at 09:33 UTC |