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

Re: splitting headache

by strat (Canon)
on Feb 26, 2002 at 13:40 UTC ( [id://147555]=note: print w/replies, xml ) Need Help??


in reply to splitting headache

I think you might better do so with a pattern-matching, e.g.
my @result = $string =~ /^([^\.]\.[^\.])(:?\.([^\.]))*$/;
or something the like.

Or use split and some after-working:

my ($firstPart, @result) = split(/\./, $string); $result[0] = $firstPart . "." . $result[0];

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Replies are listed 'Best First'.
Re: Re: splitting headache
by Wibble (Beadle) on Feb 26, 2002 at 14:45 UTC
    Thanks for the reply. I should have explained that my "Pugh.Pugh.Barney.McGrew.Cuthbert.Dibble.Grub" string was just a typical string that might occur. The 'word.groupings' would actually come anywhere, not just at the start. Thanks again though.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found