http://www.perlmonks.org?node_id=1016673


in reply to How to store matched $1 values one by one to array?

G'day rekhasri,

Welcome to the monastery.

Take a look at the push function.

I can't see anywhere in your code where you're adding anything to an array. However, what you've written is rather difficult to read: take a look at Markup in the Monastery.

You probably want something like:

my @agent_ids; # outside logfile reading loop ... if (...) { ... push @agent_ids, $agent_id; }

-- Ken