P01 - Find the last element of a list.

Author: Ryan Connelly

Use of the Whatever type to grab the last element of a list.

Example

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

Source code: P01-topo.pl

use v6;

sub last-elem(@list) {
    @list[* - 1];
}

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