A basic challenge of iterators
sub mymap(@list, &block) { my @result; while @list { push @result, &block(@list.shift); } @result; } my @lines = $file.lines; mymap(@lines, &block);
What happens to @lines after the call to mymap?
It's emptied by the repeated shifts.
continued...