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

Thank you

But what I want is to store the three variables, not one of them. An array of arrays formed by the list that generates the "fileparse"

;)
  • Comment on Re^2: Complex structures and function "map"

Replies are listed 'Best First'.
Re^3: Complex structures and function "map"
by ikegami (Patriarch) on Oct 21, 2011 at 19:20 UTC
    map doesn't store anything, it returns a list. What list do you want it to return, a list of references to arrays?
    sub func { ... return \@a; } map { func(...) } ...
    sub func { ... return [ ... ]; } map { func(...) } ...
    sub func { ... return ...; } map { [ func(...) ] } ...

      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

        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.