Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Help with regex

by trizen (Hermit)
on May 07, 2014 at 10:18 UTC ( #1085296=note: print w/ replies, xml ) Need Help??


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; } }


Comment on Re: Help with regex
Download Code
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!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-08-31 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (358 votes), past polls