in reply to using split

You can get what you want like this:
my $blah = 'reagen OR siedl OR smith AND jack'; my ( @names, @split_values ); push @{ /\A(?:OR|AND)\z/ ? \@split_values : \@names }, $_ for split ' +', $blah;