in reply to translate a character into a number


How about something like this:
my $char = 'A'; my $num = -64 + ord uc $char; $char = chr(64 + $num); # Translate back (to uppercase)

--
John.

Replies are listed 'Best First'.
Not under EBCDIC, but not a worry
by RMGir (Prior) on Apr 25, 2002 at 14:27 UTC
    my $char = 'A'; my $num = -64 + ord uc $char;
    Won't work for EBCDIC, but I'm guessing that's not a widespread problem :)
    --
    Mike
Re: Re: translate a character into a number
by NaSe77 (Monk) on Apr 25, 2002 at 09:44 UTC
    thats infact a good idea ... merci