Re: Hash - narff

2006-07-07 Thread Beginner
On 5 Jul 2006 at 10:56, Mumia W. wrote: > Beginner wrote: > > Hi, > > > > I am being a bit lazy here. I already had this hash defined (cut & pasted > > from another file) and > > didn't want to re-type it. > > > > my %char = ( > > 65 => 'a', > > 66 => 'b', > > 67 => 'c', > > 68

Re: Hash - narff

2006-07-05 Thread Rob Dixon
Beginner wrote: > > I am being a bit lazy here. I already had this hash defined (cut & > pasted from another file) and didn't want to re-type it. > > my %char = ( > 65 => 'a', > 66 => 'b', > 67 => 'c', > 68 => 'd', > 69 => 'e', > 70 => 'f', > 71 => 'g', > 72 => 'h', > 73 => 'i',

Re: Hash - narff

2006-07-05 Thread Mumia W.
Beginner wrote: Hi, I am being a bit lazy here. I already had this hash defined (cut & pasted from another file) and didn't want to re-type it. my %char = ( 65 => 'a', 66 => 'b', 67 => 'c', 68 => 'd', [...] But now I need to find the key given the value. EG: Wh

Re: Hash - narff

2006-07-05 Thread Dr.Ruud
"Beginner" schreef: > I am being a bit lazy here. I already had this hash defined (cut & > pasted from another file) and didn't want to re-type it. > > my %char = ( > 65 => 'a', > ... > ); > > > But now I need to find the key given the value. EG: What is the ASCII > value for 'a'? > > Am I being d

Re: Hash - narff

2006-07-05 Thread Mr. Shawn H. Corey
Beginner wrote: > But now I need to find the key given the value. EG: What is the ASCII value > for 'a'? > %char = reverse %char; Note that this trick only works if the values of the original hash are unique. -- __END__ Just my 0.0002 million dollars worth, --- Shawn "For the things

RE: Hash - narff

2006-07-05 Thread Timothy Johnson
You'd be better off making a second hash: my %reverse_char; while(my($key,$value) = each %char){ $reverse_char{$value} = $key; } print $reverse_char{a}; -Original Message- From: Beginner [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 05, 2006 8:48 AM To: beginners@perl.org Subj