[Israel.pm] LWP Q.

Shlomi Fish shlomif at iglu.org.il
Thu Jun 28 09:55:04 PDT 2007

On Thursday 28 June 2007, Ernst, Yehuda wrote:
> hello!
> I am trying to run this
> $res = $browser->get ("http........................
> my @p = $res-> =~ m|somthing(.*?)somthing|;
> $p[0] is empty.
> but if i print $res->as_string in the middle
> $res = $browser->get ("http........................
> print $res->as_string;
> my @p = $res-> =~ m|somthing(.*?)somthing|;
> $p[0] is not empty.

This snippet works for me:


use strict;
use warnings;

use LWP::UserAgent;
use Data::Dumper;

my $ua = LWP::UserAgent->new();

my $res = $ua->get("http://www.shlomifish.org/");

my @p = ($res->content() =~ m{<p(.*?)</p>});

print Dumper(\@p);

I'm using perl-5.8.8-12mdv2008.0 on Mandriva Cooker. It would be useful if you 
could provide a full script that reproduces this problem, and mention your 
perl version and platform.


	Shlomi Fish

Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
    -- An Israeli Linuxer

More information about the Perl mailing list