#/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 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.
>  
> Thanks for your time.
> 
> Greg Keenan 
> Lucent Technologies * 
> Level 1, 68 Waterloo Road 
> North Ryde NSW 2113 
> Australia 
> * +61 2 9491 6898 
> * [EMAIL PROTECTED] 
> 
>  
-- 
  Jeff Pan
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - The way an email service should be


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to