Okay, it might be that I am returning in that loop, so the matches aren't being kept! How do I prevent the matches that the condition is true for from getting to @all_matches but reaching @all_pronoun_matches?

I have tried removing the "return" and putting the @all_matches push statements in else, of the foreach. This didn't work:

It just sorted as if there were no condition statement to separate them. Like everything went into @all_matches

For clarity, this is the output I'm looking for:

2 match(es) in which the subject of move is animals :

Section 1_1: Radially symmetrical animals move slowly or not at all .

Section 1_1: Cnidarians also have epithelial cells with muscle fibers whose contractions enable the animals to move , as well as nerve nets that integrate their body activities .


1 match(es) in which the subject of move is cavity :

Section 1_1: Flatworms -LRB- phylum Platyhelminthes -RRB- have no body cavity , lack organs for oxygen transport , have only one entrance to the gut , and move by beating their cilia .


2 match(es) in which the subject of move is they :

Section 1_1: Others , the sea butterflies and heteropods , have a modified foot that functions as a swimming organ with which they move through open ocean waters .

Section 1_1: Because fluids are relatively incompressible , they move to another part of the cavity when muscles surrounding them contract .

Even with another heading: "Here are the pronouns:" before "they" shows up.


In reply to Re^4: Return 2 arrays, sort the same, and concatenate them by jonc
in thread Return 2 arrays, sort the same, and concatenate them by jonc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.