P18 - Extract a slice from a list. Indices start at 1.

Author: Ryan Connelly

Example

> say get-slice(<a b c d e>, 2, 4);
b c d

Source code: P18-topo.pl

use v6;

sub get-slice(@list, $start, $end)
{
    @list[$start - 1 ... $end - 1];
}

say "{get-slice(<a b c d e>, 2, 4)}";