use warnings; use strict; my $str = "x.z.y"; my ($first, $second) = $str =~ /(.+)\.([^.]+)$/; print "$first,$second\n"; __END__ x.z,y