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

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(...) ] } ...

Replies are listed 'Best First'.
Re^4: Complex structures and function "map"
by nando (Acolyte) on Oct 21, 2011 at 20:48 UTC

    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.