in reply to Help with regex

Try this:
#!/usr/bin/perl use strict; use warnings; use diagnostics; my $file = $ARGV[0]; open(my $fh, '<', $file) or die "$file: $!"; my $query; while (<$fh>) { if (/^Query=\s(\S+)/) { $query = $1; } if (defined($query) && /^>(\S+)/) { print "$query\t$1\n"; undef $query; } }

Replies are listed 'Best First'.
Re^2: Help with regex
by rocketperl (Sexton) on May 08, 2014 at 13:42 UTC
    Thanks a lot! worked like a charm!