$_ = "'Pugh.Pugh'.Barney.McGrew.Cuthbert.Dibble.Grub"; my @keepers = grep defined $_, /'(.*?)'|([^.]+)/g; print map "<$_>\n", @keepers;