Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Using Map to Create AoA

by Dietz (Curate)
on Oct 16, 2005 at 15:58 UTC ( #500578=note: print w/replies, xml ) Need Help??

in reply to Using Map to Create AoA

map { split(" ", $arr->[$_]) } 0..$#{$arr} should do

Update: Rereading your question this is not what you're seeking for. Following will save also the index.

map { [ split(" ", $arr->[$_]." $_") ] } 0..$#{$arr};

But as pg already said, there is no obvious advantage in storing the index.

Replies are listed 'Best First'.
Re^2: Using Map to Create AoA
by pg (Canon) on Oct 16, 2005 at 16:09 UTC

    This gives a flat structure:

    $VAR1 = [ 'A', '-4', 'C', 'C', '-4', 'B', 'B', '-4', 'A', 'A', '-2', 'C', 'C', '-3', 'B' ];
      Sorry for untested code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://500578]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2016-10-20 20:50 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (281 votes). Check out past polls.