http://qs321.pair.com?node_id=270684


in reply to Alpha base-26 to base-10...

Yet another take. Clear and elegant, but quite inefficient given large maximums.

{ my $count; my %h = map {$_ => ++$count} 'a'..'zzz'; sub alphabetic_to_base10 { return $h{ lc( $_[0] ) } or die; } }