in reply to Pushing Arrays into Hash without nesting

Hi treeshark, welcome to the monastery! :)

my guess is that here in your last sub addSomeNumbersFromSource

>

my @array = $source{$data} ; return @array;

you rather need to flatten the array-ref to a list before assigning it to another array.

my @array = @{ $source{$data} } ; return @array;

edit

otherwise @array = ( [  ... the-source-data ... ] ) has just one array-ref. (aka a "nested array" in your words)

whenever you have something like

@array = $scalar

that'll result into a one-element array.

... and $source{$data} is certainly a scalar, presumably holding an array-ref.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Pushing Arrays into Hash without nesting
by treeshark (Initiate) on Feb 14, 2021 at 15:29 UTC
    Perfect!
    Many thanks for your speedy reply