[Bioperl-l] Very basic Perl/BioPerl Help

Terry Jones tcj25 at cam.ac.uk
Thu Apr 14 15:28:48 EDT 2005


| foreach my $accn (@accn1) {
| push @unique1,$accn unless (grep(/$accn/, at accn2));
| }

Just one more comment on this. You'd be safer doing

foreach my $accn (@accn1) {
  push @unique1,$accn unless (grep(/^\Q$accn\E$/, at accn2));
}

To guard against false substring matches (with the ^ and $) and
against the chance that $accn contains a special regexp character (via
\Q and \E).

Sorry if this sounds picky... I'm just trying to help a little. Things
like this can be a pain to track down when/if they finally bite.

Terry



More information about the Bioperl-l mailing list