On May 1, 2013, at 11:27 AM, Noah wrote: > Hi there, > > I want to figure out a way to create a loop that will do actions based on > matches it collects in the loop and continue to do actions on all matches > till these are not m > > Hope this pseudo code makes sense:
Not quite (see below). > > 1) start loop > 2) find all matches > 3) end loop > 4) start loop > 5) do some action based on the matches before > 6) look for similar matches found in step 2 based on the output from step 5 > 7) end loop > 8) go back to step 4 until all matches have received the action in step 5 and > there are no more matches collected. One problem with this pseudo-code is that you seemingly want to start on the same loop at steps 1) and 4). Therefore, it is more a trace of steps than pseudo-code that can be executed (by a pseudo-computer, of course). See if you can rewrite your pseudo-code so that it only needs one loop statement. Questions that will help: 1. What are you matching? Strings? 2. Where do the things you are trying to match reside? An array? Some external data source? 3. Do your actions in step 5) involve one match or a combination of matches? 4. How does finding a match add to the search space (step 6)? 5. What is the output from step 5? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/