in reply to associate that array with this hash?
Looks to me like the old "taking a reference to the same array many times" problem. Because @temp is a package variable, you'll get the same reference each time and end up storing multiple copies of the last record. Is that what you're seeing?
Fixing it is easy. Either create a new @temp each time with my like this:
while (<PARMFILE>) { next if /^#/ || /^\s*$/; chomp; my @temp=split(/\s+/,$_); $dbparms{$temp[2]} = \@temp; }
or copy the array each time:
while (<PARMFILE>) { next if /^#/ || /^\s*$/; chomp; @temp=split(/\s+/,$_); $dbparms{$temp[2]} = [@temp]; }
See perldoc perldsc for more description of this problem.
--"The first rule of Perl club is you don't talk about Perl club."
|
|---|