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.


In reply to Re: Checking links between web-pages by Random_Walk
in thread Checking links between web-pages by yacoubean

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.