in reply to from array to hash with grep

Try using map instead:

my %inp = map {/^\w{3}_(\w)/; ($1, 1)} @inp;