Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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
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 chilling in the Monastery: (8)
As of 2014-09-18 08:03 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (109 votes), past polls