in reply to Re: Combining 3 files
in thread Combining 3 files
Hmmm...still struggling with this one and getting an error :
Can't use an undefined value as an ARRAY reference at combine_primer_lists.pl line 42, <INFILE> line 1.
relating to this line:
} @{$dataset->{$col[0]}})[0]->[2];Could you explain what this line is doing?
#!/usr/bin/perl #22/06/2011 use strict; use warnings; use File::Slurp; use Data::Dumper; my @data; my @col; my @dataset; my $a; my $b; my @fields; my %out; open INFILE, "<Primer-Rev1" or die $!; open my $outfh, '>', "outputfile.txt" or die $!; for my $nr (1..2) { for my $line (read_file('Primer-For'.$nr)) { my @col = split(/\t/,$line); push @{$data[$nr - 1]->{shift(@col)}},\@col; } } while (<INFILE>){ @col = split(/\t+/, $_); chomp (@col); my ($header, $length, $tm, $sequence) = @col[0..3]; # expecting file3 line in @col my @results = ($col[0],$col[3]); for my $dataset (@data) { push @results,(sort { my $diff_a = $col[2] - $a->[1]; $diff_a *= -1 if $diff_a < 0; my $diff_b = $col[2] - $b->[1]; $diff_b *= -1 if $diff_b < 0; $diff_a <=> $diff_b; } @{$dataset->{$col[0]}})[0]->[2]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Combining 3 files
by Anonymous Monk on Jun 24, 2011 at 10:06 UTC | |
by garyboyd (Acolyte) on Jun 27, 2011 at 09:11 UTC | |
by Anonymous Monk on Jun 27, 2011 at 10:27 UTC | |
by garyboyd (Acolyte) on Jun 27, 2011 at 14:47 UTC | |
by Anonymous Monk on Jun 27, 2011 at 14:58 UTC | |
|