$ perl -Mstrict -Mwarnings -E ' my $host = q{a.b.c}; my $re = qr{([a-zA-Z][-a-zA-Z0-9]*\.[a-zA-Z]+)$}; my $base = ($host =~ $re)[0]; # How I might have written it say $base; $base = ($host =~ m{($re)}) [0]; # How you wrote it say $base; $base = ($host =~ m{($re)}) [1]; # Fodder for another SoPW say $base; ' b.c b.c b.c