Lance Prais wrote:

> 
> open (WHATSNEWFILE, "< $whats_new_index_txt_filename")     || die "can't
> open $file: $!";
> 
> while (<WHATSNEWFILE>) {
>         chomp;
>         $file_line = $_;
>         $file_line =~ s/[\t\n\e\f\r]//g;
>         if ($file_line eq "") {
>         last; #break
>         }
> if ($line_count < 20) {
> #---------------------------------------------------------Counter
>         $line_count++;
> #--------------------------------------------------------Increase counter
>         print "-----> Count: $line_count\n";
>         @line_array = split("::", $file_line);
>         # Assemble the table that we are going to insert into the template


>         if ($bgcolor_flag == 0) {
>         $bgcolor_flag = 1;
>         print "-----> bgcolor_flag 1: $bgcolor_flag\n";
>         $whats_new_index_text = $whats_new_index_text . $tr_bgcolor_one .
> "\n";
>         } else {
>         $bgcolor_flag = 0;
>         print "-----> bgcolor_flag 0: $bgcolor_flag\n";
>         $whats_new_index_text = $whats_new_index_text . $tr_bgcolor_two .
> "\n";
>         }

you should consider replace the above with:

$whats_new_index_text .= $bgcolor_flag ? "$tr_bgcolor_two\n" :
                                         "$tr_bgcolor_one\n";
$bgcolor_flag = !$bgcolor_flag;



>         $whats_new_index_text = $whats_new_index_text . "    " .
> $td_label_value_root . $font_label_string_root;
>         $whats_new_index_text = $whats_new_index_text . "<a href=\"" .
> "../" . $result_path . $line_array[0];
>         $whats_new_index_text = $whats_new_index_text . $line_count .
> $alert_index_jsp_filename . "\">" . $line_array[1];#Trying to include the
> counter value
>         $whats_new_index_text = $whats_new_index_text .
> "<\/a><\/font><\/td>\n";
>     }

also you might want to try replace them with:

$whats_new_index_text .=<<"TEXT";
    $td_label_value_root$font_label_string_root
<a 
href="../$result_path$line_array[0]$line_count$alert_index_jsp_filename">$line_array[1]</a></font></td>
TEXT

which reads better.

if you don't care anything beyond the first 20 lines, you should consider 
adding a 'else{last;}' to your script so that you can exit faster. if your 
file has a million line, you don't want to read everything. you just need 
the first 20 lines.

now, what's your problem with the line counting thingy? why can't you simply 
include it in the HTML file? what problem you run into?

david

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

Reply via email to