in reply to match loop failure
It looks like you want something like this:
my %hash; while ( <INFILE> ) { ( my $line = $_ ) =~ s/\s+$//; my ( $Rank, $id, $C, $Position ) = split /\t/, $line; next unless $Rank =~ /\d/; $hash{ $Rank } = "$id\t$C\t$Position"; } while ( <INFILE2> ) { ( my $line = $_ ) =~ s/\s+$//; my @b = split /\t/, $line; next unless $b[ 0 ] =~ /\d/; my $Start_rank = $b[ 1 ]; if ( exists $hash{ $Start_rank } ) { print join( "\t", $Start_rank, $hash{ $Start_rank }, @b[ 2 .. +9 ] ), "\n"; } else { print "no match\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: match loop failure
by Anonymous Monk on Jun 10, 2011 at 08:22 UTC |