I have an array of elements which are basically HTML tags. Below, is an example
<L>
<LI>
<LI_Label>Label1</LI_Label>
<LI_Title>Title1</LI_Title>
</LI>
<LI>
<LI_Label>Label2</LI_Label>
<LI_Title>Title2</LI_Title>
</LI>
<LI>
<LI_Label>Label3</LI_Label>
<LI_Title>Title3</LI_Title>
</LI>
</L>
I am trying to extract only the LI_Title elements and store them into a separate array which I want to then concatenate into 1 complete string. For extract and store, I am using the below script. However, when I print the array, the entire block of HTML is in the Found_LI array and not just the LI_Title elements as I am expecting. Hoping someone here can point out what i am doing wrong below?
foreach (@po_siblings)
{
if ($_ =~ /LI_Title/)
{
push(@found_LI,$_);
}
}
print "@found_LI\n";
@po_siblingsdoes not contain what you think it does. You think it's an array with one element per line, but its elements are actually bigger than that. (Maybe even the whole thing is just a single element?)ifstatement with something likepush @found_LI, m/<LI_Title>.*?<\/LI_Title>/g.