in reply to search for exact string
Hi try this,
use strict; my $toFind="String"; while(<DATA>){ my $line=$_; chomp($line); if($line=~m/\b$toFind(?=[^\w\.]+|$)/i){ print "$line\n"; } }
__DATA__ blah blah string blah important stringstuff we wish to keep Unimportant string more stuff we wish to String.o Some more unimportant String.c
Punitha
In Section
Seekers of Perl Wisdom