Next Program Repair Shop 137

Capturing the same pattern repeatedly

     Subject: Re: string tokenization
     Message-Id: <20010627.084604.1001243552.6624@dhthomaslnx.mcafee.com>
     > I am working on an autometic emailing program...intended to be
     > written in perl I have a file of rows of email addresses and
     > names separated by a space and each entry by a linefeed
     >  
     > emailadd FirstName LastName
     > emailadd2 FN2 LN2
     ...
     if ($line =~ /(\w+)\s(\w+)\s(\w+)/) {
       my $email = $1;
       my $first = $2;
       my $last = $3;
     ...
        my ($email, $first, $last) = split /\s/, $line;
        next unless defined $last;


Next Copyright © 2002 M. J. Dominus