On Jan 9, 2008 6:54 PM,  <[EMAIL PROTECTED]> wrote:
> I have a serties of strings
>
> john doe
> sam f smith
> joe s thomas jr
>
>
> i need a regex that will return each word in the string.  I have tries
> variations on (.*)\b(.*) but i can't get it.  what is the proper
> syntax?

Have you considered using split?

#!/usr/bin/perl

use strict;
use warnings;

while (<DATA>) {
    my @name_parts = split;
    print join(", ", @name_parts), "\n";
}

__DATA__
john doe
sam f smith
joe s thomas jr

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to