use warnings; use strict; use Data::Dumper; my @CELLS=( 'A-1', 'A-2', 'A-3', 'A-4', 'B-5', 'B-6', 'C-7', 'C-8'); my %hash=map { /^(.*)-(\d+)$/; $1=>$2} @CELLS; print STDERR "hash DUMPER:\n", Dumper(\%hash), "\n";