Now that the OP updated code tags is obvious he didn't mean @val2 but @val[2]
You are pushing @val2 not @val.
Better use strict and warnings to catch typos!
Please put <code> </code> tags around your code and data
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: Store the outcome of a foreach loop in an array
by LanX
in thread Store the outcome of a foreach loop in an array
by perl_5eeker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |