in reply to Re^7: regexp over multiple lines
in thread regexp over multiple lines
Thanks for the detailed reply :-)
Although I can follow what you are doing in your code example, I'm a bit confused about one thing. You seem to be processing the @data array line by line, whereas I'm reading my data into a single string variable (slurping, as recommended by the forum). Please correct me if I've misunderstood :-)
Where you have:
my @data = ('<p id=paragraph_1>', '<a href="http://www.link1.com">Link1</a>', '<a href="http://www.link2.com">Link2</a>', '<a href="http://www.link3.com">Link3</a>', '</p>', '<p id=paragraph_2>', '<a href="http://www.link4.com">Link4</a>', '<a href="http://www.link5.com">Link5</a>', '<a href="http://www.link6.com">Link6</a>', '</p>',);
I seem to have:
my $myData = <WEB_DATA>;While googling, I came across the pos() function, which is used to find the offset or position of the last matched substring. Maybe this could help me when slurping files?
|
|---|