Hi, need help again.
I have a file and it can have one line or many lines with the words I'm trying to match
Words to match:
"... Lot End..."
I need to capture the last line that has this occurrence.
I thought I could just push all the match lines to an array and then get the last element but somehow it does not work.
Here is a script I'm trying:
[sup] while (my $cline = <$hadlerdirfile_fh>)
{
chomp $cline ;
if ($cline =~/End lot/g )
{
push @three_clines, $cline;
my $last = pop@three_clines ;
print "$last \n";
}
}[/sup]
Thank you.
I have a file and it can have one line or many lines with the words I'm trying to match
Words to match:
"... Lot End..."
I need to capture the last line that has this occurrence.
I thought I could just push all the match lines to an array and then get the last element but somehow it does not work.
Here is a script I'm trying:
[sup] while (my $cline = <$hadlerdirfile_fh>)
{
chomp $cline ;
if ($cline =~/End lot/g )
{
push @three_clines, $cline;
my $last = pop@three_clines ;
print "$last \n";
}
}[/sup]
Thank you.