Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: pattern matching and array comparison

by reneeb (Chaplain)
on Jun 13, 2005 at 20:18 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-23 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found