title: Perl Multidimensional array column compare and display whole content with satisfied condition
body: <p>I am facing little issue in taking array index for comparison and displaying the result. I have a tab delimited file with 9 columns and more than 100 rows. I want to compare the 8th column element of ith row with the 7th column element of i+1th row. If it is smaller than the 7th column element then print entire row else if it is greater than the 7th column element the compare the 6th element of both row and only print if the row if the 6th element is bigger.</p>
  
  <p>Sample File</p>
  
  <pre><code>Recep_L_domain  PF01030.22      112     sp|P00533|EGFR_HUMAN    2.50E-30        104.7   57      167     Receptor
  Furin-like      PF00757.18      149     sp|P00533|EGFR_HUMAN    4.10E-29        101.3   185     338     Furin-like
  Recep_L_domain  PF01030.22      112     sp|P00533|EGFR_HUMAN    3.60E-28        97.8    361     480     Receptor
  GF_recep_IV     PF14843.4       132     sp|P00533|EGFR_HUMAN    1.60E-46        157.2   505     636     Growth
  Pkinase PF00069.23      264     sp|P00533|EGFR_HUMAN    2.70E-39        135     712     964     Protein
  Pkinase_Tyr     PF07714.15      260     sp|P00533|EGFR_HUMAN    8.40E-88        293.9   714     965     Protein
  </code></pre>
  
  <p>For example if we compare the last two row then 8th column element is bigger than the next row's 7th column element, then in this case it should compare the two 6th column element and print the only row which is bigger. So from this two row it should print only last row. For me the below code is only printing the values if it is smaller, but I want to ask how can I compare 6th element and print results if 8th column is bigger?</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use Data::Dumper;
  
  open(IN,"&lt;samplecode.txt");
  
  my @Alifrom;
  my @Alito;
  my @data; ## multidimensional array
  
  while(&lt;IN&gt;){
      chomp $_;
      #next if $_=undef;
      my @line = split("\t", $_);
      ##my($a, $b, $c, $d, $e, $f, $g, $h, $i) = split(/\t/,$_); // catch data and storing into multiple scalar variable
  
      push @data, [@line];
  }
  
  for (my $i = 0; $i &lt; @data ; $i++){
  
      if ($data[$i][7] gt $data[$i][6]){
  
          for (my $j = 0; $j &lt; @{$data[$i]}; $j++){
              #@Alifrom = map $data[$i][$j+6], @data;
              print "$data[$i][$j]\t";
          }
      }
      #else
      print "\n";
  }
  </code></pre>