in reply to Alpha base-26 to base-10...
I'd prefer something more readable than concise. It's a concise enough problem anyway.
sub b26_to_b10 { my $base_10 = 0; for (split //, lc shift) { $base_10 *= 26; $base_10 += ord() - 96; } return $base_10; }
-sauoq "My two cents aren't worth a dime.";
|
---|
In Section
Seekers of Perl Wisdom