in reply to Re^2: from array to hash with grep
in thread from array to hash with grep
Now the code you can use to do that, can read for example:
It'll create a pair like ("A", "abc_A_bla") for a match, and an empty list for no match.@flat = map { /\w{3}_(\w)/ ? ($1, $_) : () } @inp;
Assign to the hash, and you get:
%inp = map { /\w{3}_(\w)/ ? ($1, $_) : () } @inp;
|
---|