in reply to Re: Array reference
in thread Array reference

well.. I also know that no body wants to write a code for free.. I have asked for the help not for the entire code..

#!/usr/bin/perl use strict; open (FILE, "ip.txt") || die "can't: $!"; open (OUTPUT,">op.txt") || die "can't: $!"; my @lines=(); my @l1=(); my @l2=(); @lines=<FILE>; my %hash=(); my $i=0; my $j=$i+1; my @arr1=(); my @arr2=(); my @arr3=(); while($j <= $#lines) { #print "$j\n"; @l1=split(/\t/,"$lines[$i]"); @l2=split(/\t/,"$lines[$j]"); if(abs($l2[3]-$l1[3]) <= 500 && $l1[6] eq $l2[6]) { $hash{$lines[$j]}=1; if(!exists $hash{$lines[$i]}) { $hash{$lines[$i]}=1; push(@arr1,$l1[3]); push(@arr2,$l1[7]); push(@arr3,$lines[$i]); #print OUTPUT "$lines[$i]"; } #print OUTPUT "$lines[$j]"; push(@arr1,$l2[3]); push(@arr2,$l2[7]); push(@arr3,$lines[$j]) } else { @s_arr2=sort{$a<=>$b}@arr2; if($s_arr2[-1]-$s_arr2[0] <= 500) { //got struck $i=$j; $j=$i+1; }

Thanks.