Minor nit, but if you amend the split slightly to my $foo = (split /:\s+/, $_)[1];you can eliminate the leading space from the hash keys. That space might trip you up later if you are expecting to be able to do something like if ( exists $codes{q{code90}} ) { ... }.