--- Ronald J Kimball
<[EMAIL PROTECTED]> wrote:
> That should get your code working. There are ways
> to write the sort so
> that it is more efficient, by avoiding all the
> subroutine calls that your
> code will make. If you'd like to know more just say
> so!
>
>
> Ronald
>
Ronald,
Thank you for your advice on the script. I would be
very interested to know how you would approach the
problem. I am an illustrator first, and programmer
comes a way down my list of abilities. =8O)
I got the script working, but instead of trying to do
it all within the same string, I split the data down
into key/value pairs. I also used this to compile a
list of unique referrers, i.e. summing all the
referrers that come from the same domain. The code is
as follows:
__SNIP__
for ( @refs ) {
chomp;
( $key, $value ) = split;
$ref_list{ $key } = $value;
$key =~
/^(http:\/{2}(w{3}\.)?[a-zA-Z0-9\-]+\.[a-zA-Z]+\.?[a-zA-Z]{0,3})/
||
/^(http:\/{2}\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/;
$unique{ $1 } += $value;
}
print "Referrers:\n";
for ( sort {
$ref_list{ $b } <=> $ref_list{ $a }
or $b cmp $a
} keys %ref_list ) {
print "$_, $ref_list{ $_ }\n";
}
My apologies for the weird formatting, but IE is not
exactly BBEdit. =8O)
Many thanks,
Richard
________________________________________________________________
Nokia 5510 looks weird sounds great.
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
The competition ends 16 th of December 2001.