I was looking for a way to get the first n values from a list, so that I
could do something like:

  [% FOREACH item = mylist.sort('date').first(10) %]

but I couldn't find such a thing... is there a different preferred way
to do this, or could we change first to something like the following?:

  first => sub {
    my $list = shift;
    if (my $howmany = shift) {
      [@{$list}[0 .. $howmany-1]]
    } else {
      $list->[0]
    }
  };

[Or perhaps we need a more generic list.slice mechanism? (Although I'd
still like the more intuitive list.first(10) than having to say
list.slice(0..9) or somesuch]

Tony






Reply via email to