in reply to Splitting multiline scalars into different array entries
I'm not 100% sure what you need, but assuming you need what I think you need .. :) .., replacing your loop with this works:
Any use to you?
This outputs:foreach my $row (@AoA) { my @foo = map { split /\n/ } @$row; for( my $i = 0; $i < $#foo; $i += $width ) { push @new_rows, [ @foo[ $i .. -1 + $i + $width ] ]; } }
$VAR1 = [ [ 'single', 'cell', 'values' ], [ 'are', 'really', 'easy' ], [ 'but', 'multiline', 'stilton' ], [ 'these', 'cells', 'is' ], [ 'aren\'t', 'suck', 'great' ], [ 'back', 'to', 'life' ], [ 'back', 'to', 'reality' ], [ 'with', 'more', 'cells' ] ];
-- Foxcub
#include www.liquidfusion.org.uk
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Splitting multiline scalars into different array entries
by davis (Vicar) on Aug 05, 2005 at 10:40 UTC | |
by polettix (Vicar) on Aug 05, 2005 at 11:12 UTC | |
by Tanalis (Curate) on Aug 05, 2005 at 11:19 UTC | |
by davis (Vicar) on Aug 05, 2005 at 11:34 UTC |
In Section
Seekers of Perl Wisdom