http://www.perlmonks.org?node_id=555447


in reply to from array to hash with grep

Since it is fixed-length scanning, we can use pack() and unpack():
my @inp = ("abc_A_bla", "abc_B_bla", "abc_C_bla") ; print "@{[ keys %{{ unpack '(x4 A A4)*', pack( '(A*)*', @inp) }}]}";