perlfaq nodetype
faq_monk
<P>
Use the split function:
<P>
<PRE> while (<>) {
foreach $word ( split ) {
# do something with $word here
}
}
</PRE>
<P>
Note that this isn't really a word in the English sense; it's just chunks
of consecutive non-whitespace characters.
<P>
To work with only alphanumeric sequences, you might consider
<P>
<PRE> while (<>) {
foreach $word (m/(\w+)/g) {
# do something with $word here
}
}
</PRE>
<P>