You can use a hash-slice to assign a list of values to a list of keys directly. Your inner while loop becomes:
while (<IN>) { chomp; my %rec; @rec{@fields} = split /:/; $users{$rec{name}} = \%rec; }
In reply to Re: assigning to a hash via split
by danger
in thread assigning to a hash via split
by aardvark
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |