On Fri, Jun 8, 2012 at 11:44 AM, lina <lina.lastn...@gmail.com> wrote:
> On Sat, Jun 9, 2012 at 12:16 AM, lina <lina.lastn...@gmail.com> wrote:
>> Hi,
>>
>> Here is the to-be-processed file,
>>
>> $ more try
>>  #  RESIDUE AA STRUCTURE BP1 BP2  ACC     N-H-->O    O-->H-N
>> N-H-->O    O-->H-N    TCO  KAPPA ALPHA  PHI   PSI    X-CA   Y-CA
>> Z-CA
>>    1  174   V              0   0    0      0, 0.0     2,-0.3     0,
>> 0.0     0, 0.0   0.000 360.0 360.0 360.0 137.8   47.8   27.7   76.9
>>    2  175   H        -     0   0    0      2,-0.0     2,-0.3     0,
>> 0.0     0, 0.0  -1.000 360.0-153.6-152.0 146.1   50.8   25.5   78.2
>>
>> I wish to print the value under the BP1, namely
>>
>> 0
>> 0
>>

Here is how I am able to do it. I'm sure there are better approaches.

HTH,

Chris

#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my @data;

while(my $line = <DATA> ) {
  push @data, [ split /\s+/, $line ];
}

#print Dumper \@data;


for my $item ( @data ) {
  print @$item[4],"\n";
}

__DATA__
#  RESIDUE AA STRUCTURE BP1 BP2  ACC     N-H-->O    O-->H-N    N-H-->O
   O-->H-N    TCO  KAPPA ALPHA  PHI   PSI    X-CA   Y-CA   Z-CA
1  174   V              0   0    0      0, 0.0     2,-0.3     0, 0.0
  0, 0.0   0.000 360.0 360.0 360.0 137.8   47.8   27.7   76.9
2  175   H        -     0   0    0      2,-0.0     2,-0.3     0, 0.0
  0, 0.0  -1.000 360.0-153.6-152.0 146.1   50.8   25.5   78.2


***RESULTS****
BP1
0
0

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to