in reply to Howto print multiple matches in a line

Replace if (/.../) with while (/.../g) to get all matches. Use parens around what you want to capture. Use $1 to get what's in the parens, not $_.

In this, case you can write it concisely as

while (<FH>) { print( join( "\t", /\w\s+\w+\s+\w+\s+\w+\s+\w+/g ), "\n" ); }

Replies are listed 'Best First'.
Re^2: Howto print multiple matches in a line
by ashnator (Sexton) on Nov 11, 2008 at 04:11 UTC
    Thanks a lot dear... ;)