-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Koehn
Sent: Monday, February 23, 2004 9:41 AM
To: [EMAIL PROTECTED]
Subject: Re: counting differently


[EMAIL PROTECTED] wrote:

> Is there a way to force a variable to walk through the alphabet the 
> way
> it can numbers?
>  
> ie: for numbers:  $k=0; $k=$k+1; would give you 1
>  
> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any
> way of doing this that will?
> 
> 
> ----------------------------------------------------------------------
> --

$k = 'a';
$k = chr(ord($k)+1);

$k will now contain 'b'.  This works for ASCII, and English.  No 
promises for Unicode or other languages.  This actaully walks the ASCII 
sequence of characters, so the character after 'z' will be '{'.

Michael Koehn
Bergen County Schools

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Another way that works,
 
$k = 'a';
$k++;

Later,
Matt


Matt Ross
Motorola
Configuration Management ePIMS
Wk: 817.245.6540
2 way pager: 888.468.0815
E-mail:  [EMAIL PROTECTED]

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to