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