0
Hi, I need some help here.
I am writing a perl program that will identify certain patterns in a text file using regex. However, when the search term is not present in the text, I need the program to inform the user.
I open the file and save it in a array and walk through it with a bow for. Use if to find my pattern and print it. When I add elsifor else, The program prints for every line he ran that didn’t find the pattern. I needed him to print only when he reached the end of the document if he couldn’t find the pattern. does anyone know how to do that? Maybe with while. Worth the/
for($i=0; $i<=$#report; $i++){
if($report[$i] =~ /target/){
chomp $report[$i];
print "$report[$i]";
}
else{
print "not found\t";
}
}