in reply to Looping based on a Conditional
Well then, just use the tie mode of File::Tail:
if ($opt{'c'}) { open ( CATLOG, '<', $MAILLOG ) or die "Can't open $MAILLOG: $!\n"; } else { my $ref = tie *CATLOG, "File::Tail",( name => $MAILLOG, tail => -1 ) or die "Can't tie $MAILLOG: $!\n"; } while (my $line = <CATLOG>) { # ...while loop code here... }
One more thing: Always check the return value of open / close.
cheers,
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|