Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Complex structures and function "map"

by nando (Acolyte)
on Oct 21, 2011 at 20:48 UTC ( [id://932976]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Complex structures and function "map"
in thread Complex structures and function "map"

Great!

Yes I feel that I did not explained correctly. Sometimes I do not know if Google Translator is a help or an additional problem.

I would like to achieve a structure "@ array" whose elements were other arrays. As I was reading this afternoon, this is achieved by references, that being scalars, can be elements of an array.

So ... żI can by "map" to get from the output of the "fileparse" (a list of three scalar), an @array structure ($scalar1, $scalar2, ... $scalarn) where $scalarn is a reference to the list ($name, $path, $suffix)?

Perhaps the question does not even make sense, I'm blocked today

:)

Thanks for your effort to understand

  • Comment on Re^4: Complex structures and function "map"

Replies are listed 'Best First'.
Re^5: Complex structures and function "map"
by ikegami (Patriarch) on Oct 23, 2011 at 10:56 UTC

    Sorry, I hadn't noticed you had replied.

    I would like to achieve a structure "@ array" whose elements were other arrays. As I was reading this afternoon, this is achieved by references, that being scalars, can be elements of an array.

    Correct.

    So ... żI can by "map" to get from the output of the "fileparse" (a list of three scalar), an @array structure ($scalar1, $scalar2, ... $scalarn) where $scalarn is a reference to the list ($name, $path, $suffix)?

    Close.

    One can't create a reference to a list. You'll need to store $name, $path, $suffix in an array, and return a reference to that array. The three snippets I posted show ways of doing that.

    So map will end up returning a list of references to arrays. Like subs, it cannot return an array, but you can store the list in an array.

    I feel that I did not explained correctly.

    Your post did not change my understanding of the question.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found