in reply to Breaking a loop after a valid match + proper use of /t delimiter.
Output:use strict; my @lines = <DATA>; chomp @lines; foreach (@lines) { my @words = split " ", $_; print "\$_: '$_'\n"; foreach (@words) { print "'$_' "; } print "\n\n"; } __DATA__ Delimit each word with one or more spaces This is the second line
Note also that the following shorter version for the above will work also:$_: ' Delimit each word with one or more spaces' 'Delimit' 'each' 'word' 'with' 'one' 'or' 'more' 'spaces' $_: ' This is the second line' 'This' 'is' 'the' 'second' 'line'
my @words = split;
--Jim
|
|---|