Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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.

Comment on Re: Using Map to Create AoA
Select or Download Code
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 scrutinizing the Monastery: (8)
As of 2015-10-09 10:12 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (237 votes), past polls