in reply to RegExp quick question
But as for that regular expression that you're passing to split... well, I'm not sure where you're going with that, or what you're trying to do. I'm getting compilation errors when I try to run that, because your regexp doesn't look right. This would be a valid regular expression:my $str = "foo.bar"; if ($str =~ /\./) { print "Contains a period.\n"; }
However, I don't know if it actually does what you want it to do. Are you trying to split a sentence up into words, where a word can contain a period? If so, try something like this:(split(/[a-zA-Z]+(.[a-zA-Z]*)*)/, @$contentString))
If not, try to clarify what you're asking for.my @words = @$contentString =~ /([\w.]+)/g;
|
|---|