From: Edgardo Hames Date: 2004-08-28T03:03:03+09:00 Subject: Re: Question about ? operator for ASCII On Sat, 28 Aug 2004 01:59:05 +0900, Barry Sperling wrote: > Hello, > I am a nuby and I couldn't find how to get the ASCII value of a > character in a variable. I looked in the Pragmatic Programmer and did this: > > s = "ABC DE." > s.scan( /./ ) do |a| > puts ?a > end > > but only got the ASCII value of the small letter 'a' ( 97 ). What do I > need to do? I know this one!!!!! I can't believe it ;) You need to call the #chr method for integers. s = "ABC DE." s.scan( /./ ) do |a| puts a.chr end Regards, Ed -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan