in reply to Detect Two Strings in File
my $str1 = qr(C); my $str2 = qr(X); my $alert = 0; while (<DATA>) { $alert = 1 if /$str1/; $alert = 0 if /$str2/; } print "P A N I C" if $alert; __DATA__ A B C D E F
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Detect Two Strings in File
by choroba (Cardinal) on Nov 05, 2014 at 21:51 UTC | |
|
Re^2: Detect Two Strings in File
by CountZero (Bishop) on Nov 06, 2014 at 05:26 UTC |