RE: 2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
-Original Message- >> Hi, > >Hello, > >> I have a file like: >> >> A B C >> 1aa11bb11cc11 >> 2aa22bb22cc22 >> 3aa33bb33cc33 >> 4aa44bb44cc44 >> >> I have two sets of coordinates like (A2, C1) and I need to join them >>

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
Sure,this code is more brief: $hash{$i++}=[split] while (<>); thank u. On Thu, 08 Sep 2005 19:54:11 -0700, "John W. Krahn" <[EMAIL PROTECTED]> said: > Jeff Pan wrote: > > #/usr/bin/perl > > use warnings; > use strict; > > > my $i=0; > > my %hash; > > > > while (<>) > > { > > chomp; > >

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Jeff Pan wrote: > #/usr/bin/perl use warnings; use strict; > my $i=0; > my %hash; > > while (<>) > { > chomp; > s/^\s+|\s+$//g; > $hash{$i}=[split]; > $i++; You could write those four lines as: $hash{$i++}=[split]; > } > > print $hash{0}->[0],"\n"; > print $hash{1}->[2],

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Keenan, Greg John (Greg)** CTR ** wrote: > Hi, Hello, > I have a file like: > > A B C > 1aa11bb11cc11 > 2aa22bb22cc22 > 3aa33bb33cc33 > 4aa44bb44cc44 > > I have two sets of coordinates like (A2, C1) and I need to join them > to

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
#/usr/bin/perl my $i=0; my %hash; while (<>) { chomp; s/^\s+|\s+$//g; $hash{$i}=[split]; $i++; } print $hash{0}->[0],"\n"; print $hash{1}->[2],"\n"; Is this useful? On Fri, 9 Sep 2005 12:11:33 +1000 , "Keenan, Greg John (Greg)** CTR **" <[EMAIL PROTECTED]> said: > Hi, > > I

2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
Hi, I have a file like: A B C 1aa11bb11cc11 2aa22bb22cc22 3aa33bb33cc33 4aa44bb44cc44 I have two sets of coordinates like (A2, C1) and I need to join them together like aa22cc11 I am going to pull the relevent line for the fi