I have a while loop below:
while (<>)
{
my $line = $_;
if ($line =~ m/ERROR 0x/)
{
$error_found +=1;
}
}
After while loop finished, i will match somethings like “ERROR…” and i wanna store them into an array or list or hash. How can i do this?
Just push the data into an array.
Clean things up a little:
Or maybe even
Finally, realize that
grepwould do great here: