Response at end of message... -----Original Message----- From: Rod [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 12:19 PM To: '[EMAIL PROTECTED]' Subject: Match the first 3 characters of 2 words?
What is the easiest way to test the first 3 characters of two words for a match. IE: "dasf" test "dasg" to return positive. -----My Response----- Use the \b word boundary in your regex for the beginning of the word: if ($var =~ /\bdas/) { print "$var begins with 'das'\n" } else { print "$var doesn't begin with 'das'\n" } /\/\ark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>