in reply to Match typo

In addition to almut's suggestions you might look at String::Approx. I've used it in the distant past and liked it. I have no idea if it's still as good as the other options for what you're trying to do.

Replies are listed 'Best First'.
Re^2: Match typo
by Anonymous Monk on Sep 11, 2009 at 08:20 UTC
    How to check in a line words "publish" and "date" exists or not. I have to print the "matched" if publish and date both exists in line
    while(<DATA>){ $ =~ m/publish|date/; } __DATA__ The book was published on the date "20-08-2009".

      If you want an exact match, that's easy:

      while (<DATA>){ print "matched\n" if /publish/ and /date/; }

      But note that this would also match "the date was published on"...

      If the order in which the words must occur is relevant, you could do

      while (<DATA>){ print "matched\n" if /publish.*date/; }
      A reply falls below the community's threshold of quality. You may see it by logging in.