in reply to Re: extract last 1 min log and find a string
in thread extract last 1 min log and find a string

My code below repeat print out "found" more than 4 times

That's odd, because I get

syntax error at 1195905.pl line 31, near "else"
syntax error at 1195905.pl line 31, near ";}"
Unmatched right curly bracket at 1195905.pl line 33, at end of line
1195905.pl had compilation errors.
poj
  • Comment on Re^2: extract last 1 min log and find a string

Replies are listed 'Best First'.
Re^3: extract last 1 min log and find a string
by ytjPerl (Scribe) on Jul 24, 2017 at 19:55 UTC
    Hi Dude, I just copied an extra "}", why not fix it at your end?
      my $count = 0; # not $count == 0
      while (defined($line = $bw->readline)) { chomp $line; if ($line =~ /$target/) { # why target ? print "found\n"; $count = 4; last; # <-- add } }
      poj