coldy has asked for the wisdom of the Perl Monks concerning the following question:
The reason I dont use unix grep is that I need to further post process the result.my @ids =<IDLIST>; my $dir = $opts{d}; chdir($dir) or die "$!"; opendir(DIR, ".") or die "Can't open $dir: $!"; my @files = grep {/fa$/} readdir DIR; close DIR; foreach my $id (@ids) { foreach my $fasta (@files){ local @ARGV = @files; print grep (/$id/,<>), "\n"; } }
I know each $id in @ids does occur in one of the files but in my code the result of print is always empty! - also, I would like to do this at the same speed as unix grep if possible. Any suggestions?
Thanks in advance, Chris.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: faster way to grep
by toolic (Bishop) on Mar 15, 2010 at 22:44 UTC | |
by coldy (Scribe) on Mar 15, 2010 at 22:53 UTC | |
|
Re: faster way to grep
by Illuminatus (Curate) on Mar 16, 2010 at 00:59 UTC | |
|
Re: faster way to grep
by 7stud (Deacon) on Mar 16, 2010 at 08:36 UTC | |
by dsheroh (Monsignor) on Mar 16, 2010 at 11:19 UTC | |
|
Re: faster way to grep
by hok_si_la (Curate) on Mar 16, 2010 at 16:07 UTC |