|
PERL: Searching for a string in a text file problem
Looking for a bit of help. I need to search for a string of words, but unfortunately these words are located on separate lines.
for example the text output is:
United
Chanmpions
Ronaldo
Liverpool
Losers
Torres
and my script code is
print("DEBUG - checking file message");
while (<FILE>){
$line = $_;
if($line =~ /United/ ){
print("\nAbout to send email\n");
sendEmail($contacts,
"",
"Monitoring",
"\nPlease be aware that there is a problem.",
"",
"");
}
the above script will send out an e-mail when it locates United, but I need to send out an e-mail when it gets United Champions Ronaldo.
I thought something like
if($line =~ /United/n Champions/n Ronaldo/)
But no luck.
Any suggestions as to how to go about this.
|