my @month = qw(jan feb mar apr may jun jul aug sep oct nov dec); my %month = map { $_ => $month[$_] } (0..$#month); ... $m_name = $month{$m_number};