Nested_function.md 330 B

Nested function

sub make-List ($separator = ') '){
    my $count = 1;
 
    sub make-Item ($item) { "{$count++}$separator$item" }
 
    join "\n", <first second third>».&make-Item;
}
 
put make-List('. ');

Output:

1. first
2. second
3. third