file:foreach (@array){ $match=0; my @tmparr; my @line=split(/\t/); foreach $key_pos(sort keys(%conwithposition)) { if ($conwithposition{$key_pos}[0] eq '=') { if ($conwithposition{$key_pos}[1] eq $line[$key_pos]) { $match=1; }else{ $match=0; next file; } }elsif($conwithposition{$key_pos}[0] eq '!='){ if ($conwithposition{$key_pos}[1] ne $line[$key_pos]) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '>'){ if ($conwithposition{$key_pos}[1] gt $line[$key_pos]) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '>='){ if ($conwithposition{$key_pos}[1] ge $line[$key_pos]) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '<'){ if ($conwithposition{$key_pos}[1] lt $line[$key_pos]) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '<='){ if ($conwithposition{$key_pos}[1] le $line[$key_pos]) { $match=1; }else{ $match=0; next file; } } } if ($match){ #All the conditions met. Push this line of file to @result_arr foreach $col(sort {$a<=>$b} keys(%cols_pos)){ push @tmparr,$line[$col]; } $tmparr=join("|",@tmparr); push @listcols,$cols_pos{$col}; push @result_arr,[ $tmparr ]; } }#file:for