How do I get Perl to print letters in order?

tim85a

New member
Hi, I wanna get Perl to print a list if letters, I know how to get it to print numbers (1, 2, 3 ect, ect) but I would like to print letters (a, b, c...... z, aa, ab....... az, ba......)

I've got the code below:

$x = a;
do{
print "$x\n";
$x++;
}while($x < 5);

$x started as 1 so I got 1, 2, 3, 4 but now I've changed it to "a" I get a, b, 1, 2, 3, 4??

So, I tried changing while ($x <5); to while ($x < zz); but just got "a"?? Can anyone help??

Thanks in advance.
Tim.
 
Back
Top