Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Search for Second Occurence of Substing and get containing text

by k_manimuthu (Monk)
on May 07, 2010 at 06:03 UTC ( #838864=note: print w/ replies, xml ) Need Help??


in reply to Search for Second Occurence of Substing and get containing text

For your code

if(Dumper($page) =~ /===Comments===(.*?)=Microarray Data=/s) { $lit_comments = $1; }

Search the match one time only

You want to do the stuff's repeated. You will use the while loop and use the 'g' (global modifier) in your code.

while(Dumper($page) =~ /===Comments===(.*?)=Microarray Data=/gs) { $lit_comments = $1; }

Otherwise. Try this

Dumper($page) =~ s/===Comments===(.*?)=Microarray Data=/&my_process($& +)/ges; sub my_process { my ($content)=@_; ## Do You stuff's Here return $content; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2016-06-25 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (323 votes). Check out past polls.