sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:

Below is a segment of a script I actually had programmed for me perhaps 2 years ago or so. I lost the commonurls.html file and was wondering if anyone here could help me reconstruct it. If I remember correctly, all it used to be was a page with links and numbers but i'm not sure.

Can someone take a look at this segment (hopefully i copied over all you need to see) and see if you can help determind what this file needs to look like?

Thanks!

# Get the commonurlfile open FILEHANDLE,"<$commonurlfile" || &error("failed to open $commonurl +file"); @fileurls=<FILEHANDLE>; $commonurls= join(" ",@fileurls); close(FILEHANDLE); if ((defined($co->param('myurl')) &&($co->param('myurl')!~m/^\s*$/)) ||(defined($co->param('competitorurl1')) &&($co->param('competitorurl1')!~m/^\s*$/)) ||(defined($co->param('competitorurl2')) &&($co->param('competitorurl2')!~m/^\s*$/))){ $theurls{$co->param('myurl')}=$co->param('myurl') if ((defined($co->param('myurl'))) &&($co->param('myurl')!~m/^\s*$/)); $theurls{$co->param('competitorurl1')}=$co->param('competitorurl1' +) if ((defined($co->param('competitorurl1'))) &&($co->param('competitorurl1')!~m/^\s*$/)); $theurls{$co->param('competitorurl2')}=$co->param('competitorurl2' +) if ((defined($co->param('competitorurl2'))) &&($co->param('competitorurl2')!~m/^\s*$/)); #PERFORM SEARCH OF ALL SEARCH ENGINES ON $url $thetable=&findlinks; if (defined($co->param('regenerate'))){ $thetable.=$common_header_split.$commonurls; } else { $thetable.="</TABLE>\n"; } &printresults($thetable); } elsif (defined($co->param('regenerate'))){ $singletable="<TABLE border=1 bgcolor='white' cellpadding=5 margin +=0 cellspacing=0>"; $commonurls=$singletable.$common_header_begin.'Common URLs'.$commo +n_header_tail.$commonurls; &printresults($commonurls); } else{ #print out a submission form &submissionform; } sub regenerateurls{ #regenerates the common urls #<!--<A href='$newurl' target=_new>--> place link text in here<!--</A> +--> local $commonurltable=""; local $newurl=""; local $row=""; local $body=""; local $hits=0; %sorted=(); foreach $c_url (keys %commonurls){ $sorted{$c_url}=$c_url; $total=0; foreach $key (keys %searchengines){ $newurl=$searchengines{$key}.$commonurls{$c_url}; $hits=&retrievepage($newurl,$hitstring{$key},$startindexstring +{$key},$endindexstring{$key},$offsetstr{$key}); $total+=$hits; push(@{$sorted{$c_url}{hits}},$hits); } $sorted{$c_url}{total}=$total; } foreach $c_url (sort{$sorted{$a}{total}<=>$sorted{$b}{total}}(keys %so +rted)){ foreach $index (sort{$b<=>$a}(keys(%colorindex))){ $color=$colors[0]; if ($sorted{$c_url}{total} > $colorindex{$index}){ $color=$colors[$index]; last; } } $row="<TR bgcolor='".$color."'><TD><FONT FACE='Arial' size=3> $c_u +rl </FONT></TD>\n"; foreach $hits (@{$sorted{$c_url}{hits}}){ $row.="<TD><FONT FACE='Arial' size=3 color='blue'> $hits </FON +T></TD>\n"; } $row.="<TD><FONT FACE='Arial' size=3 color='maroon'> $sorted{$c_ur +l}{total} </FONT></TD>\n</TR>\n"; $body.=$row; } $commonurltable.="$body \<\/TABLE\>"; open FILEHANDLE,">$commonurlfile" ; print FILEHANDLE $commonurltable; close(FILEHANDLE); #&error("PRINTING NEW URLS<BR>$commonurltable"); $commonurltable=""; }