while ($line =~ /(\d+)\s+(\w+)/g) { $hash{$1} = $2; }
In your inner loop.
Update: added /g, as noted by AnomalousMonk.
In reply to Re: creating a hash from a text file.
by moritz
in thread creating a hash from a text file.
by changma_ha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |