use 5.010; use strict; use warnings; use HTML::TreeBuilder::XPath; my $url = "http://www.youtube.com/results?search_query=run+flo+rida"; my $tree = HTML::TreeBuilder::XPath->new_from_url($url); my $xpath = '(//*[@id="search-results"]/li)[1]/div[2]/h3/a/@href'; my @nodes = $tree->findnodes($xpath); say $_->getValue for @nodes;