I apologize for not being clear and I do appreciate all the valuable input I get from this community.
Without the print statement I will not be able to debug my code. I want to make sure my array is carrying the proper line/data before attempting to process it. This is what I got after reading all the comments. I think I'm missing a small piece and I can't figure it out.
open my $tailf, "tail -f $logFile |" or die;
while (<$tailf>) {
chomp;
my $line = $_;
if($line =~ m/ on $ipaddress/)
{
if (scalar(@matches) <= 2){
push(@matches, $line);
}
else {
last;
}
}
}
foreach $line (@matches){
print "$line\n";
}
close $tailf;