Apple
Mango
Grapes
Bananas
Avocado
####
Grapes not in list
Strawberry not in list
Grapes not in list
Strawberry not in list
Grapes
Strawberry not in list
Grapes not in list
Strawberry not in list
Grapes not in list
Strawberry not in list
Grapes not in list
Strawberry not in list
####
Grapes
Strawberry not in list
####
use strict;
use warnings;
open (FILE,"fruits.txt");
while () {
if (/Grapes/) {
print $_;
} else { print "Grapes not in list\n";}
if (/strawberry/i) {
print $_;
}
else {
print "Strawberry not in list\n";
}
}
close FILE;