http://www.perlmonks.org?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; } }

Replies are listed 'Best First'.
Re^2: Alpha base-26 to base-10...
by Aristotle (Chancellor) on Jul 02, 2003 at 07:51 UTC
    That's simply a pre-memoized version of BrowserUk's approach.

    Makeshifts last the longest.