in reply to Re: Re: Pushing unique items onto an array
in thread Pushing unique items onto an array

how do I determine if any of those links match the leading one I used to start the fetch, and subsequent links found on pages followed from there?

Strip any anchors off immediately upon capturing the link. Keep a single hash with all of the seen URLs. When you start, add your root URL to the hash.

If I blindly just push the new elements onto the hash, I'll overwrite any existing keys (and values) which have the same key, which might not be good for efficiency.

You won't overwrite the keys. Perl will see that the key exists and simply change the value. You can use exists() if you want to, but it isn't really necessary and I wouldn't do it.

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Re: Re: Pushing unique items onto an array