Q&A > strings > How do I return the first n words of a string? - Answer contributed by Zombie Wyzelli
$str = 'yo ho ho and a bottle crumbs.
hangin and bangin in the upper-class slums.';
print join ' ', (split /\s+/, $str)[0..4];
An electronic device
Being the designated driver
Spending time with a celebrity
I never won anything
I never play the lottery
I haven't checked my spam folder recently
Results (414 votes). Check out past polls.