-----Original Message----- >> Hi, > >Hello, > >> I have a file like: >> >> A B C >> 1 aa11 bb11 cc11 >> 2 aa22 bb22 cc22 >> 3 aa33 bb33 cc33 >> 4 aa44 bb44 cc44 >> >> 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 first coordinate into an >> array then pull out the relevant element then repeat the steps for the >> second coordinate e.g. >> >> @lines = <GRIDFILE>; >> @line = $lines[3]; >> $coordData1 = $line[1]; >> @line = $lines[2]; >> $coordData2 = $line[3]; >> ...do something with $coordData1 & $coordData2 >> >> I'm hoping for a better way and I'm looking for suggestions. > >You may want something like: > >my @lines = map [ split ], <GRIDFILE>; >...do something with $lines[1][0] & $lines[0][1]
Thanks John & Jeff for the suggestions. I've gone with John's solution. Looks like I need to read up on the map function. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>