in reply to Store the outcome of a foreach loop in an array

update

Now that the OP updated code tags is obvious he didn't mean @val2 but @val[2]

original

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

Replies are listed 'Best First'.
Re^2: Store the outcome of a foreach loop in an array
by perl_5eeker (Novice) on Jan 10, 2019 at 22:29 UTC

    Thanks for your quick response @val2? - I meant to extract the 3rd column of the array "@val2".

      $val[2] gives the third element of @val.

      [link] creates a link outside code tags, that's why I misinterpreted your code.

      See also my update.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice