On Friday, February 15, 2002, at 06:47 PM, Stephen Turner wrote:
>>> #!perl -l
>>> use POSIX;print~~strtol pop,36
> Well, I repeat my challenge. Can anyone beat Karsten's 46 without using
> POSIX?
Hmm, maybe not...
I can get to 55 or so... But here is an expanded solution -
#!perl
while (<DATA>) {
chomp;
s/^\s+//; # Delete whitespace...
s/\s+$//;
split //; # Create an array of characters
for (@_) { # Walking thru we get position Power
s#\D#-55+ord$&#e; # If we have Letters then make Numbers
$z=36*$z+$_; # Make the Base Conversion to Base 10
}
print"$z ";
$z = 0; # Reset the char to 0
}
=pod
Test Data results in:
375 159 625047 718501
respectively...
=cut
__END__
AF
4F
DEAF
FEED
Obviously A LOT of room for shortening! Which, of course,
is left to those interested in such matters :)
Cheers! :]
_Sx____________________
('> -Sx- IUDICIUM
//\ Have Computer -
v_/_ Will Hack...