A becomes 1, B becomes 2, etc

2001-12-13 Thread Collins, Joe (EDSI\\BDR)
Hi, How can I convert the scalar 'A' (or 'a') to 1, 'B' to 2 and so on? Related: how do I get the true internal value for A, i.e. ascii value? Thanks! Joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: A becomes 1, B becomes 2, etc

2001-12-13 Thread Curtis Poe
--- Collins, Joe (EDSI\\BDR) [EMAIL PROTECTED] wrote: Hi, How can I convert the scalar 'A' (or 'a') to 1, 'B' to 2 and so on? my %alpha_to_num; @alpha_to_num{ A .. Z } = ( 1 .. 26 ); print $alpha_to_num{ A }; Related: how do I get the true internal value for A, i.e. ascii value? print

Re: A becomes 1, B becomes 2, etc

2001-12-13 Thread Jenda Krynicky
From: Collins, Joe (EDSI\\BDR) [EMAIL PROTECTED] How can I convert the scalar 'A' (or 'a') to 1, 'B' to 2 and so on? Related: how do I get the true internal value for A, i.e. ascii value? $num = ord($char) - ord('A') + 1 or if you do it often my

Re: A becomes 1, B becomes 2, etc

2001-12-13 Thread Jeff 'japhy' Pinyan
On Dec 13, Jenda Krynicky said: $num = ord($char) - ord('A') + 1 or if you do it often my $char_base = ord('A') - 1; ... $num = ord($char) - $char_base; No benefit to that, really. ord('A') is calculated at compile-time, not run-time. -- Jeff japhy Pinyan

Re: A becomes 1, B becomes 2, etc

2001-12-13 Thread _brian_d_foy
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: On Dec 13, Jenda Krynicky said: $num = ord($char) - ord('A') + 1 or if you do it often my $char_base = ord('A') - 1; ... $num = ord($char) - $char_base; No benefit to that, really. ord('A') is calculated at