use Text::ParseWords qw(quotewords); my $line = q(hi my name is 'john doe'); @words =quotewords(' ', 0, $line); print join "\n", @words,"\n";