my $str="Hello (World New) of (all) or not(a and b)"; my @l=$str=~/(\(.+?\)|[^()\s]+)/gs; print "$_\n" for @l;