Hello everyone.

I have a problem that has me blinded. I'm working on a script for finding
the 3 greatest numbers on a group of data stored in a TXT file.

I keep getting the same 500 error.
I used some pieces of code from others scripts I made that work correctly,
but this is my headache. Maybe is a syntax error, but I am so tired of
looking for it. So I ask you to help me tracking the mistake in this script.

Thank you to all of you for taking the time

imagenes.dat is stored in the same directory that the script.
---------------------------------------CODE--------------------
#!/usr/bin/perl

$file_url = "http://www.sistemedic.com/votar";;

$bd = imagenes.dat;

   open (DATOS, "$bd") || die "Error: no se puede abrir el archivo";

   while (<DATOS>) {
      $reg = $_;
      ($file, $vot_tot, $sum_vot, $coment, $prop) = split(/\|/,$reg);
      $prom = $sum_vot / $vot_tot;
      $ltop{$file} = $prom;
   }
   close (DATOS);

#   @proms = values (%ltop);
   @images = keys (%ltop);

   $ind=0;
   $max_1=0;
   $max_2=0;
   $max_3=0;

   foreach $comp (values(%ltop)){
      if ($comp > $max_1) {
         $max_1 = $comp;
         $ind_1 = $ind;
      }elsif ($comp > $max_2){
         $max_2 = $comp;
         $ind_2 = $ind;
      }elsif ($comp > $max_3){
         $max_3 = $comp;
         $ind_3 = $ind;
      }else{
         $ind = $ind;
      }
      $ind ++;
   }

   $prom_1 = sprintf '%3.2f', $max_1;
   $prom_2 = sprintf '%3.2f', $max_2;
   $prom_3 = sprintf '%3.2f', $max_3;

   print "content-type: text/html \n\n";
   print "<html><head>\n<meta http\-equiv\=\"Content\-type\">\n";
   print "<title>Top 3</title></head>\n";
   print "<body bgcolor=\"#667788\" text=\"#FFFFFF\" link=\"#000000\"
vlink=\"#000000\">\n";
   print "<table width=\"750" border=\"1\" bordercolor=\"#008080\"
cellpadding=\"5\" cellspacing=\"5\">\n";
   print "  <tr> \n";
   print "    <td width=\"250\" align=\"center\"><a
href=\"$file_url/$images[$ind_1]\" target=\"_blank\">\n";
   print "      <img src=\"$file_url/$images[$ind_1]\" width=200
border=\"2\"></a><br>$prom_1</td>\n";
   print "    <td width=\"250\" align=\"center\"><a
href=\"$file_url/$images[$ind_2]\" target=\"_blank\">\n";
   print "      <img src=\"$file_url/$images[$ind_2]\" width=200
border=\"2\"></a><br>$prom_2</td>\n";
   print "    <td width=\"250\" align=\"center\"><a
href=\"$file_url/$images[$ind_3]\" target=\"_blank\">\n";
   print "      <img src=\"$file_url/$images[$ind_3]\" width=200
border=\"2\"></a><br>$prom_3</td>\n";
   print "  </tr>\n";
   print "</table>\n";
   print "</html>\n";

exit;
-----------------------------

As you can see I have made some weird arrangements, trying to find out the
error.

-rm-



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to