in reply to grep not equal
It probably works fine. But it's an inefficient solution; for each element in @all_genes, your grep must inspect every element in @covered_genes. That's probably fine if your data set is small, but what little I know about genome projects leads me to the conclusion that data sets are rarely small.
A more efficient solution would put "@covered_genes" into hash keys for constant time lookups:
my %covered_lookup; @covered_lookup{ @covered_genes } = (); for my $item ( @all_genes ) { say $item unless exists $covered_lookup{$item}; }
With Perl, almost most times you're solving set problems you can solve them efficiently with hashes.
Dave
|
|---|