BTW, proper indention and omitting unnecessary whitespace isn't a bad thing :-)
use strict; use warnings; while (<DATA>) { if ( $_ =~ m/\bGuinea\b/ ) { print "We have a match\n"; # m/\bGuinea\b$/ matches Guinea at end # m/^\bGuinea\b$/ matches Guinea at the beginning } else { print "We do not have a match\n"; } } __DATA__ Papua New Guinea I live in Guinea Guinea Bissau Equatorial Guinea
See also Perltidy.
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
In reply to Re: Matching a Word Exactly
by karlgoethebier
in thread Matching a Word Exactly
by GuiPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |