while (<>) { exit if /error.*error/; # do whatever you want to do... }
(if you just want to exit the loop - not the program - use last in place of exit)
In reply to Re: match a word then exit
by almut
in thread match a word then exit
by ktl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |