my $i = 1; my %occult = map { $_ => int ($i++ / 9) + 1} ('A' .. 'Z'); my $news = 'FOX'; print join( '', map $occult{$_}, split '', $news ) . $/;