Re: Trouble with hash lookup

2003-01-28 Thread John W. Krahn
James Kipp wrote: > > Should be a simple question. I am trying to only print the element of the > hash, that matches the $user string but it prints all of the elements. What > am I missing. > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones' => "dj

Re: Trouble with hash lookup

2003-01-28 Thread John Baker
On Tue, 28 Jan 2003, Rob Dixon wrote: > > > > $user = "jsmith"; > > my %lookup = ( > > 'jsmith' => "jsmith1", > > 'djones' => "djones2", > > 'tday' => "tday3", > > ); > > > > for my $key (keys %lookup) { > > print "$lookup{$key}\n" if $key == $user; > > } > > Ed is rig

RE: Trouble with hash lookup

2003-01-28 Thread Kipp, James
> > > You can just do: > > print "$lookup{$user}\n"; > > HTH, Now am even more embarrassed :) Thanks Rob. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Trouble with hash lookup

2003-01-28 Thread Rob Dixon
Hi James James Kipp wrote: > Should be a simple question. I am trying to only print the element of > the hash, that matches the $user string but it prints all of the > elements. What am I missing. > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones'

RE: Trouble with hash lookup

2003-01-28 Thread Mark Anderson
>Should be a simple question. I am trying to only print the element of the > hash, that matches the $user string but it prints all of the elements. What > am I missing. print "$lookup{$user}\n"; > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones'

RE: Trouble with hash lookup

2003-01-28 Thread Kipp, James
thanks, Ed. I am pretty embarresed now :-) > -Original Message- > From: Ed Christian [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 28, 2003 3:19 PM > To: Kipp, James; [EMAIL PROTECTED] > Subject: RE: Trouble with hash lookup > > > Try replacing "==&q

RE: Trouble with hash lookup

2003-01-28 Thread Ed Christian
Try replacing "==" with "eq" print "$lookup{$key}\n" if $key eq $user; > -Original Message- > From: Kipp, James [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 28, 2003 3:12 PM > To: [EMAIL PROTECTED] > Subject: Trouble with hash lookup > > > Should be a simple question. I am tryin