my %hash = map { /^([^-]*)-(.*)$/; exists $$a{$1}? (push(@{$$a{$1}},$2) and ()): ( $1=>$$a{$1}=[$2] ) } @CELLS;