in reply to using map and anonymous subroutines
This isn't tricky, it just takes into account that the first map doing the split will create more elements and then the next map just appends newlines to everything it gets.
@result = map "$_\n", map split, @file;
|
|---|