in reply to RegExp quick question
I'm also not quite sure what you're going for here. If you
have a word such as 'foo.bar', you'd probably just want
to do something like
Or, if the word might contain multiple periodsmy($before, $after) = split(/\./, $word);
If you need to check that there is a period in the word, you should use the if statement posted above before splitting. If you want to verify that a word contains only letters, you'd want to do a matching regular expression prior to the splitmy @tokens = split(/\./, $word);
And potentially throw in some /s* if you want to check for whitespace in it.$word =~ /^[a-zA-Z]+\.[a-zA-Z]*$/;
|
---|
In Section
Seekers of Perl Wisdom