From: ťÔ Íő <[EMAIL PROTECTED]>
>   my $text;
>   for my $left_index (1..WIDTH) {
>    last if $start_index < $left_index;
>      $text .= $texts_arr[$start_index - $left_index] . ' ';
>   }
>   $text .= join(" ", @texts_arr[$start_index..$end_index]) . ' ';
>    for my $right_index (1..WIDTH) {
>     last if $end_index + $right_index > $#texts_arr;
>      $text .= $texts_arr[$end_index + $right_index] . ' ';
>   }
>    $text_hash{$url} = $text;

As far as I can tell this could easily be rewriten with no loops. If
I understand it correctly you want to get all the texts from
$start_index-WIDTH to $end_index+WIDTH so something like:


my $left_index = $start_index - WIDTH;
$left_index = 0 if $left_index < 0;
my $right_index = $end_index + WIDTH;
$right_index = $#texts_arr if $right_index > $#texts_arr;

my $text = join(" ", @texts_arr[$left_index .. $right_index]);

should do what you are after. There are probable other things, but
this caught my eyes.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to