in reply to Checking links between web-pages

If I grok what you mean

When Page 3 links to Page 7 you wish to ensure Page 7 also links back to Page 3...

Pass 1, examine all pages and build a hash keyed by linked page containing arrayrefs to an array of pages that linked it. for instance if on page 3 you found a link to page 7 push @{$hash{7}}, 3 of course you check first the key for 7 exists and create if required

Pass 2, go through the hash keys and see what is in the attached array to get a list of all pages that linked to this page

update

Oh how dumb I am, sequential integer page numbers and I am babbling on about a hash... replace the above code with push @{$array[7]}, 3 and s/hash/array/g

Here is a rough framework

# something like this.... # @Pages is a list of integer page numbers # get_links_linked_from($) does what it looks like foreach my $page (@Pages) { my @Links=&get_pages_linked_from($page); foreach (@Links) { $Link_Store[$_]=[] unless $Link_Store[$_]; push @{$Link_Store[$_]}, $page; } } # assuming you start on page 1 for (my $i=1; $i<=$#Link_Store; $i++) { my $linkers = join ", ", @{$Link_Store[$i]}; print "Page $i linked from $linkers\n" }

Cheers,
R.

Replies are listed 'Best First'.
Re^2: Checking links between web-pages
by yacoubean (Scribe) on Oct 13, 2004 at 16:37 UTC
    Thanks for trying to help, but that's not exactly what I am trying to do. I just want to know when a page is linked to, not to create a back link.