Thanks for helping out with this I really appreciate the input from you guys.
I tried the above code but I get an error:
Use of uninitialized value in printf at parse_result.txt.pl line 23, <$fh> line 45.
The code I used was practically the same as yours except for changing the name of the input file to results.txt and changing the " " to "\t"
#!/usr/bin/perl use strict; use warnings; use Text::CSV; my @result; my $csv = Text::CSV->new ( { sep_char => '\t ' } ) # should set binar +y +attribute. or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<", "result.txt" or die "result.txt: $!"; while ( my $row = $csv->getline( $fh ) ) { if ($row->[0] =~ m{\QHWUSI-EAS95L_0025_FC:3:1:5232:1082#0//E}) { if (@result) { $result[1] = $row->[3]; } else { $result[0] = $row->[2]; } } } #printf "%s\t%s\n", @result; printf @result; $csv->eof or $csv->error_diag(); close $fh;
In reply to Re^2: compare lines within a file
by garyboyd
in thread compare lines within a file
by garyboyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |