use HTML::TreeBuilder; # given that the HTML to be parsed is in a variable named $html . . . # this line extracts the links from the html: my $links = HTML::TreeBuilder->new_from_content( $html )->extract_links; # and this iterates over the list of link data, slightly massaging each one: for ( map { [ $_->[0], ( $_->[0] =~ m#://(.*)# ), $_->[1]->as_text ] } @$links ) { # here are the three variables you wanted: my( $url, $address, $text ) = @$_; }