Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2016-12-05 18:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (89 votes). Check out past polls.