Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Extract Data between Tagsby ppremkumar (Novice) |
on Mar 05, 2013 at 18:18 UTC ( [id://1021886]=perlquestion: print w/replies, xml ) | Need Help?? |
ppremkumar has asked for the wisdom of the Perl Monks concerning the following question: Team I need help with fixing the below problem, for which I am unable to find a solution. I am trying to write a program to extract all data within the tag "BIB." The problem is this: When my find code is this while ($data1 =~ m{(<BIB>.*</BIB>)}gx)the output comes as
which is not what I want. When my find code is changed to this while ($data1 =~ m{(<BIB>)}gx)I get something closer; at least the number of items within the "BIB" tag matches the total number of items within "BIB." What I want is this, each entry saved as an array value: <BIB>Falco (2012)</BIB> <BIB>Falco, 2012</BIB> <BIB>ICMRT, 2012</BIB>
INPUT TEXT: In fact, <BIB>Falco (2012)</BIB> today Louise is hardly isolated. More than 5 million babies have been born using the procedure, which has become almost routine. And at the age of 28, Louise became a mother herself, giving birth to a baby boy name Cameron—conceived, by the way, in the old-fashioned way (<BIB>Falco, 2012</BIB>; <BIB>ICMRT, 2012</BIB>).
Back to
Seekers of Perl Wisdom
|
|