in reply to Re: Pushing unique items onto an array
in thread Pushing unique items onto an array
Let's say I start with one link, the one I fetch first (the parent url). I push that into a hash, with the url itself (?) as the key, and a value of '1' for unique (along with other values, like the HTML content, a status code, and other stuff).
I then grab the links from that url after fetching, and come back with an array of say, 500 other links. I can sort those links for uniqueness (grep !$saw{$_}++, map {s/#.*$//;$_ } $thing;), but 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?
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. Thanks for your help sauoq.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Pushing unique items onto an array
by sauoq (Abbot) on May 30, 2003 at 17:27 UTC | |
|
Re: Re: Re: Pushing unique items onto an array
by sauoq (Abbot) on May 30, 2003 at 17:43 UTC |