in reply to Returning arrays from a package
Your problem is simple: you are declaring the arrays that you want to export as lexicals instead of globals in your code. Exporter then accesses the globals and ends up exporting empty arrays.
Try our (@overall, @electronics, @safety); breakouts(@products); at line 23.
You will also need to rework breakouts to directly load the arrays, instead of creating locals and attempting to return those. You cannot return multiple lists from a function in Perl — perl will merge them all into a single flat list and put it all in the first array.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning arrays from a package (feature qw/refaliasing/;)
by LanX (Saint) on Oct 02, 2019 at 00:15 UTC | |
by jcb (Parson) on Oct 02, 2019 at 01:08 UTC | |
by LanX (Saint) on Oct 02, 2019 at 11:38 UTC | |
by jcb (Parson) on Oct 02, 2019 at 23:41 UTC |