On Saturday 10 November 2007 06:39, Dr.Ruud wrote:
> "Jonathan Lang" schreef:
> >   while (<DATA>) {
> >     ($a[0], $a[1], $a[2], $a[3], $a[4], $b) = /(\d+), (\d+), (\d+),
> > (\d+), (\d+), Powerball: (\d+)/;
> >     push @common, @a; push @powerball, $b;
> >   }
>
> A slightly different way to do that, is:
>
>    while (<DATA>) {
>      if (my @numbers =
>            /(\d+), (\d+), (\d+), (\d+), (\d+), Powerball: (\d+)/) {

Another way to do that:

       /Powerball:/ and my @numbers = /\d+/g;


>        push @common, @numbers[0..4];
>        push @powerball, $numbers[5];
>      }
>      else {
>        ...
>      }
>    }



John
-- 
use Perl;
program
fulfillment

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


Reply via email to