Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Selecting successive lines

by ansh batra (Friar)
on Sep 17, 2013 at 09:01 UTC ( [id://1054409]=note: print w/replies, xml ) Need Help??


in reply to Selecting successive lines

I have a simple way
keep a flag,when you get the name set the flag as one and if flag is one then get score.

foreach(traverse data) { if($data =~ /jack/) { //put some variable here for name $flag=1; } if($flag ==1 && $data=~ /Math Score2 - /) { $score=$'; $flag=0; } }

Since you need to check for multiple names , you may also use
if ( grep( /^$data$/, @array ) )

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-25 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found