Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: split giving me a splitting headache

by hdb (Monsignor)
on Apr 25, 2013 at 05:24 UTC ( [id://1030584]=note: print w/replies, xml ) Need Help??


in reply to split giving me a splitting headache

I'd prefer bart's greedy match. But if you want splitting, then split, pop, rejoin:

use strict; use warnings; my $string = "x.y.z"; my @pieces = split /\./, $string; my $last = pop @pieces; my $first = join ".", @pieces; print "$first $last\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-28 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found