open (TEXTFILE, "c:/perl_programs/$fsearch") || die "\nCAN'T OPEN $fsearch\n"; print "\nEnter a string to search for: \n"; chomp ($search = <STDIN>); @line = <TEXTFILE>; string regardless of case. for (@line){ $count++; if ($_ =~ /$search/i) { print "\nLine that matched <$search> found on line #$count\n"; print "$_\n"; }} if (!($_ =~ /$search/)) { print "\nsubstring <$search> NOT found\n"; }
In reply to problem printing message if search item is not found by cravena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |