number.\n;
}
-Original Message-
From: The Ghost [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 26, 2006 10:28 PM
To: Perl Beginners
Subject: num to alpha
What's the easiest way for me to turn a number into a letter?
2 - b
5 - e
26 - z
27 - error
my %convert = qw[ 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m
14 n
15 o 16 p 17 q 18 r 19 s 20 t 21 u 22 v 23 w 24 x 25 y 26 z ];
Hi,
I know John Krahn is a fan of %map. He has advised me on using it before.
Just wondering if there was any reason he chose to use %convert instead
Timothy Johnson wrote:
Just for the sake of one more way to do it:
###
use strict;
use warnings;
my %numbers;
my $letter = 'a';
my $userinput = 23;
foreach(1..26){
$numbers{$_} = $letter;
$letter++;
}
Or:
my %numbers;
@numbers{ 1 .. 26 } = 'a'
Keenan, Greg John (Greg)** CTR ** wrote:
my %convert = qw[ 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m
14 n
15 o 16 p 17 q 18 r 19 s 20 t 21 u 22 v 23 w 24 x 25 y 26 z ];
Hi,
Hello,
I know John Krahn is a fan of %map.
I am?
He has advised me on using it before.
Just
I know John Krahn is a fan of %map.
I am?
He has advised me on using it before.
Just wondering if there was any reason he chose to use %convert
instead in his example above.
%map and %convert are just hash names, you can use any name that you want.
Sorry - my mistake.
Still trying to
Keenan, Greg John (Greg)** CTR ** wrote:
I know John Krahn is a fan of %map.
I am?
He has advised me on using it before.
Just wondering if there was any reason he chose to use %convert
instead in his example above.
%map and %convert are just hash names, you can use any name that you want.
What's the easiest way for me to turn a number into a letter?
2 - b
5 - e
26 - z
27 - error
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response