So you want to split the HTML in a way that $_ becomes one full line of text?

It really depends how the HTML is written. If it's written all on one line 
(which is the case sometimes) you would probably need to go another route.

If the HTML is written on multiple lines (and it should be for readability) you 
can try splitting on \n (newline). You may also try \r for carriage return.

Hope this helps.

On May 3, 2013, at 6:59 AM, Edward and Erica Heim <edh...@bigpond.net.au> wrote:

> Hi all,
> 
> I'm using  LWP::UserAgent to access a website. One of the methods returns 
> HTML data e.g.
> 
> my $data = $response->content;
> 
> I.e. $data contains the HTML content. I want to be able to parse it line by 
> line e.g.
> 
> foreach (split /pattern/, $data) {
>    my $line = $_;
> ......
> 
> If I print $data, I can see the individual lines of the HTML data but I'm not 
> clear on the "pattern" that I should use in split or if there is a better way 
> to do this.
> 
> I understand that there are packages to parse HTML code but this is also a 
> learning exercise for me.
> 
> Thanks in advance, Edward
> 
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to