What do I gain by filtering URLs through Perl's URI module?

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2010-04-24T17:13:26Z Indexed on 2010/04/25 15:13 UTC
Read the original article Hit count: 229

Filed under:
|
|

Do I gain something when I transform my $url like this: $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;

© Stack Overflow or respective owner

Related posts about perl

Related posts about uri