Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: RegExp quick question

by plaid (Chaplain)
on Apr 04, 2000 at 00:57 UTC ( #6757=note: print w/replies, xml ) Need Help??

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 '', you'd probably just want to do something like
my($before, $after) = split(/\./, $word);
Or, if the word might contain multiple periods
my @tokens = 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 split
$word =~ /^[a-zA-Z]+\.[a-zA-Z]*$/;
And potentially throw in some /s* if you want to check for whitespace in it.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://6757]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2022-05-16 19:59 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (63 votes). Check out past polls.