in reply to Re: creating a hash from a text file.
in thread creating a hash from a text file.

Loop condition
    while ($line =~ /(\d+)\s+(\w+)/) { ... }
will produce infinite loop. Use /g regex modifier to extract all pairs:
    while ($line =~ /(\d+)\s+(\w+)/g) { ... }