not quite understand why dose Perl flatten the results.
Because Perl functions can only return one thing: a list of scalars. A list of scalars is created from the two arrays and returned by map.
Then you ask to assign that list to a pair of arrays. There's no way for Perl to know how to split that list to assign it to two arrays, so it assigns the entire list to the first array.
In reply to Re^2: how to assign map results to arrays
by ikegami
in thread how to assign map results to arrays
by perlfan99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |