Ryuchi has asked for the wisdom of the Perl Monks concerning the following question:
I want to iterate over this to convert each row to:[ ['123*jeff','tortoise','qwerty'] ['456*john','parrot','azerty'] ['789*jane','budgie','abcdef'] ]
Since I don't know how much additional data there is at the end*, I want to shift the data off, then unshift it back on. However, I am having great difficulty with shift; it doesn't seem to want to work. The splitting of the string is trivial; it's the shift/unshift which is being sticky.['123','jeff','tortoise','qwerty']
returns:my @row = $bigarray[$count]; print "dumper1:".Dumper(@row); my $item = shift @row; print "dumper2:".Dumper($item);
* Actually, I do, it varies.dumper1:$VAR1 = [ '<a href="http://www.wizards.com/default.asp?x=dnd/comp/mess +age" title="Click to Subscribe" >Berronar\'s Salve</a>', 'Heroic', '<em>Forgotten Realms Player\'s Guide</em>' ]; dumper2:$VAR1 = [ '<a href="http://www.wizards.com/default.asp?x=dnd/comp/mess +age" title="Click to Subscribe" >Berronar\'s Salve</a>', 'Heroic', '<em>Forgotten Realms Player\'s Guide</em>' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shifting of 2D array slices
by jwkrahn (Abbot) on Dec 06, 2008 at 23:27 UTC | |
by holli (Abbot) on Dec 07, 2008 at 00:57 UTC | |
by kyle (Abbot) on Dec 07, 2008 at 03:37 UTC | |
by AnomalousMonk (Archbishop) on Dec 07, 2008 at 06:16 UTC | |
|
Re: Shifting of 2D array slices
by moritz (Cardinal) on Dec 06, 2008 at 23:22 UTC | |
|
Re: Shifting of 2D array slices
by davidrw (Prior) on Dec 07, 2008 at 01:22 UTC |