in reply to thats what splice() is for...
in thread printing 20 characters in a line.
same idea, but without splice() by using more perlish features like list-flattening and arrayslicing
but I think splice is better maintainable!my @chunk; while ( ( @chunk[0..19] , @array ) = @array ) { print "@chunk\n"; }
UPDATE: Indeed, real splices are better, see "Good" style for splicing arrays for details.
|
|---|