Hi

How do I pick out matching words if there are more than one on the same
line?


Example

INFILE.TXT

www.site01.com www.site02.com www.site03.com
www.site04.com

------

while (<>) {
    if ( m!(www.\S+.com)!s ) {
#       print "$1\n";
#       print "$&\n";
        print;
    };
}
------

I want to get all the 'match' in the INFILE.TXT on separate lines to
OUTFILE.TXT

www.site01.com
www.site02.com
www.site03.com
www.site04.com

But all I get is

www.site01.com
www.site04.com

If I try $1 or $& I only get two instances of 'match'  from the first in the
line.
Any help is appreciated

Reply via email to