note
Paladin
Well, first off, you should probably always use strict and warnings. <code>use strict</code> would have found your error for you. Well, 1 of the errors.
<ol>
<li>In your final <code>for()</code> loop, you are using an array called <code>@sequence</code> which you never initialize anywhere else. I presume you meant to use <code>@gene</code> there instead.</li>
<li>Your <code>$id</code>s have regex meta chars in them (the <code>|</code>), so you need to tell Perl to treat them as normal characters.
</li>
</ol>
If you change your final part to:
<code>
for (my $i=0; $i<@genes; $i++) {
foreach my $id (@uniq) {
if ($genes[$i] =~ /^\Q$id/) {
print "$id\n";
}
}
}
</code>
it seems to work.
466253
466253