cravena has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem printing message if search item is not found
by Transient (Hermit) on Jun 20, 2005 at 13:54 UTC | |
|
Re: problem printing message if search item is not found
by ambrus (Abbot) on Jun 20, 2005 at 13:55 UTC | |
|
Re: problem printing message if search item is not found
by holli (Abbot) on Jun 20, 2005 at 14:00 UTC | |
|
Re: problem printing message if search item is not found
by cbrandtbuffalo (Deacon) on Jun 20, 2005 at 14:39 UTC | |
by omega_monk (Scribe) on Jun 20, 2005 at 15:37 UTC | |
|
Re: problem printing message if search item is not found
by thundergnat (Deacon) on Jun 20, 2005 at 17:55 UTC |