in reply to splitting headache
The grep defined is in there because on every hit, we'll get $1 as the quoted string but $2 undef, or $2 as the non-dotted string but $1 undef, and all we have to do is toss the undefs to get the final result.$_ = "'Pugh.Pugh'.Barney.McGrew.Cuthbert.Dibble.Grub"; my @keepers = grep defined $_, /'(.*?)'|([^.]+)/g; print map "<$_>\n", @keepers;
-- Randal L. Schwartz, Perl hacker
|
|---|