Try: my $exp = "The lucky coin"; $/ = undef; open (FH, $file); my $content = <FH>; close FH;
if ($content =~ /$exp/sm) { print "The string was found"; } Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] ----- Original Message ----- From: "mark sony" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 19, 2003 8:48 AM Subject: searching for a string Hi I was trying the following code : open ( fh , "test1.txt"); while (<fh>) { $string = "the lucky coin"; if ($string =~ m/(\b)the(\s)(\b)lucky(\s)(\b)coin(\b)$/) { print "Yup,exists.\n"; } else { print "nope \n"; } } But the results are not as expected. I was thinking of the following : search for "the" then ignore blank spaces,tabs,newlines and look for "lucky" .If found then also print the next word which will be lucky .Is there no pipes in perl ? mark _______________________________________________________________________ Odomos - the only mosquito protection outside 4 walls - Click here to know more! http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htm&&odomos&&w n -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]