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


Comment on Re: Search for Second Occurence of Substing and get containing text
Select or Download Code

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 taking refuge in the Monastery: (6)
As of 2014-09-19 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls