perl -e 'my $blah = "reagen OR siedl OR smith AND jack"; @names = split /\s+( AND|OR)\s+/, $blah; @split_values = $blah =~ /\s+(AND|OR)\s+/g'