Michael Oldham wrote:
Hello again,

Thanks to everyone for their helpful suggestions.  I finally got it to
work, using the following script.  However, it takes about 5 hours to
run on a fast computer.  Using grep (in bash), on the other hand, takes
about 5 minutes (see below if you are interested).  Thanks again!
[...]

How fast is this?

#!/usr/bin/perl
use strict;
use warnings;

# change below for your data
@ARGV = qw(ids.dat probe.dat);
my $idrx = '\d+\w+';

my @ids;

while ($_ = <>) {
    m/^\s*($idrx)\s*$/ && do {
        push @ids, $1;
    };

    m/^>probe:[^:]+:($idrx)/ && do {
        my $id = $1;
        if (grep $id eq $_, @ids) {
            print;
            $_ = <>;
            print;
        }
    };
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to