$_ = q{whatever "this" 'line is'}; my @elements; push @elements, $1 while /\G\s*"(.*?)"/gc or /\G\s*'(.*?)'/gc or /\G\s*(\S+)/gc; print map "<<$_>>", @elements;