P02 - Find the last two elements of a list.

Author: Ryan Connelly

Further use of the Whatever type to grab the last elements of a list.

Example

> say last-two(<a b c d e>)
d e

Source code: P02-topo.pl

use v6;

sub last-two(@list)
{
    @list[* - 2, * - 1];
}

say "{last-two(<a b c d e>)}";