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";
In reply to Re: split giving me a splitting headache
by hdb
in thread split giving me a splitting headache
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |