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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Looping over parts of an array
by mdillon (Priest) on Jun 16, 2001 at 22:42 UTC
    $page = 1; $page_size = 36; $first_item = 35; @indexes = (($page - 1) * $page_size + $first_item .. $page * $page_size + $first_item - 1); for $item (@array[@indexes]) { # do whatever to $item }
Re: How do I
by bk (Initiate) on Jun 16, 2001 at 22:21 UTC
    That's Odd... Half the subject got cut off.

      That is exactly what I was thinking of except for the last part where I would have done:

      foreach ( @array[ @{$ranges{$page}} ] ) { print $_, "\n"; }

              - tye (but my friends call me "Tye")