Hi,
I tried to make as script that would take as input two one-columned files. And output those rows that are existent in one but not in the other. This is what I got. For some reason it'll stop its work at the first row. What did I miss?
#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; #kaks üheveerulist faili, prindib need veerud mis ühes on aga teises p +ole #ehk siis suurem fail miinus väiksem my $num_args = $#ARGV + 1; if ($num_args != 3) { print "\nUsage: ./lahutaja suurem väiksem vahe(output)\n"; exit; } my $f=$ARGV[0]; my $qa=$ARGV[1]; my $out=$ARGV[2]; open FA, "< $fasta"or die "Can't open $f: $!"; open QA, "< $quala" or die "Can't open $q: $!"; open OUT,"> $out" or die "Can't open $out: $!"; my @bl = <QA>; my @a = <FA>; my %h; @h{@bl} = @bl; my @output=[grep {!exists $h{$_}} @a]; print Dumper @output ; print OUT @output; close FA; close QA; close OUT;
In reply to get difference of two arrays by naturalsciences
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |