I get something when I transform mine $urlas follows $url = URI->new( $url ):?
$url
$url = URI->new( $url )
#!/usr/bin/env perl use warnings; use strict; use 5.012; use URI; use XML::LibXML; my $url = 'http://stackoverflow.com/'; $url = URI->new( $url ); my $doc = XML::LibXML->load_html( location => $url, recover => 2 ); my @nodes = $doc->getElementsByTagName( 'a' ); say scalar @nodes;
the constructor of the URI module will clear the URI for you - for example, correctly output characters that are not valid for building a URI (see URI :: Escape ).
URI module as several advantages:
, , , , , , , , URI , , .
, , $url = URI->new( $url ); $url , URI (, , ), , URI. , XML::LibXML, , , URI URL-, .
$url = URI->new( $url );
URI
XML::LibXML