$ cat alinkswithhrefsandids.html one two three $ mech-dump --links file:alinkswithhrefsandids.html http://example.com/first+one http://example.com/second+two http://example.com/third+three $ perl -MData::Dump -MWWW::Mechanize -e " $u=WWW::Mechanize->new; $u->get( qw/ file:alinkswithhrefsandids.html /); dd( $u->links ); " do { my $a = bless([ "http://example.com/first+one", "one", undef, "a", bless(do{\(my $o = "file:alinkswithhrefsandids.html")}, "URI::file"), { href => "http://example.com/first+one", id => "first" }, ], "WWW::Mechanize::Link"); ( $a, bless([ "http://example.com/second+two", "two", undef, "a", \${$a->[4]}, { href => "http://example.com/second+two", id => "second" }, ], "WWW::Mechanize::Link"), bless([ "http://example.com/third+three", "three", undef, "a", \${$a->[4]}, { href => "http://example.com/third+three", id => "third" }, ], "WWW::Mechanize::Link"), ); }