Hi perlatwork,

On Saturday 12 Jun 2010 19:59:55 perl wrote:
> I tried to use LibXML .. when i never to the correct libXML read file
> ... when i tried to use the LWP download which is an XML .. how to use
> it please help  me ...
> 

First of all, add "use strict;" and "use warnings;". That would have caught 
your problem:

> /use LWP::UserAgent;
> my $ua = LWP::UserAgent->new;
> my $response =
> $ua->get("http://www.perlmonks.org/?displaytype=xml;node_id=3989";);
>  if ($response->is_success) {
>      my $string = $response->content;  # or whatever

You're declaring $string (as "my $string = ") inside a conditional clause, so 
it will become invalidated outside that block. You need to declare it outside 
the block:

[code] # Untested.
my $string;

if ($response->is_success) {
        $string = $response->content;
}
[/code]

For more information see:

http://perl-begin.org/topics/scoping/

Next time, please use strict and warnings and you can use the perl debugger to 
see for yourself where things go wrong:

http://perl-begin.org/topics/debugging/

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Parody on "The Fountainhead" - http://shlom.in/towtf

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
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