Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: global regex

by si_lence (Deacon)
on Jul 08, 2009 at 13:12 UTC ( [id://778254] : note . print w/replies, xml ) Need Help??

in reply to global regex

your code matches the first 'word' and prints it, then goes to the next line. One way of matching all words on a line is
while(<DATA>) { while ( /(\w+)/g ) { print "$1 "; } }