in reply to Array Searching
Of course it depends on how you define a site, should you add a subroutine to handle regex mangling to process the root domain, instead of the individual pages themselves, as this one does? But if you debug that, that ought to get you started.sub sitecounter { my @sites = @_; my(@sitepopularity); my($s,$site,@sitessorted,@validsites,@tmp); @sitessorted = sort @sites; foreach $site (@sitessorted){ push @validsites, $site unless $validsite[-1] eq $site; } foreach $site (@validsites){ foreach $s (@sites){ push @tmp $s if $site eq $s; } push @sitepopularity ($site, #@tmp); } return @sitepopularity; }
Check out the docs for push, pop, sort, and if this was a homework question I helped you with, the caveats offered to new users here who ask others to do their homework for them.
-- Hugh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array Searching
by cptstarfire (Initiate) on Mar 10, 2006 at 10:22 UTC |