in reply to Re: Matching problem
in thread Matching problem
Or to read the file into an array and use grep on the array, like this:{ local $/ = undef; open(FILE,$filename) or die "open failed on $filename: $!"; $wholetext = <FILE>; close FILE; } if ( $wholetext =~ /\b$searchword\b/ ) { # do something }
open( FILE, $filename ) or die "yadda yadda"; @data = <FILE>; if ( grep /\b$searchword\b/, @data ) { # do something; }
|
|---|