Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: pattern matching and array comparison

by reneeb (Chaplain)
on Jun 13, 2005 at 20:18 UTC ( #466281=note: print w/replies, xml ) Need Help??


in reply to pattern matching and array comparison

#! /usr/bin/perl use strict; use warnings; my $id_file = '/path/to/file/with/ids.txt'; my $fasta_file = '/path/of/fasta/file.fasta'; open(my $fh, "<$id_file") or die $!; my @ids = <$fh>; close $fh; { local $/ = "\n>"; open(my $fh, "<$fasta_file") or die $!; while(my $entry = <$fh>){ print $entry if(grep{$entry =~ /\Q$_\E/}@ids); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://466281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2021-12-02 21:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (25 votes). Check out past polls.

    Notices?