Omega -1911 wrote:
> @liners = split /(\s\[0-9],\s)Powerball:\s[0-9]/,$data_string;

Instead of split, just do a pattern match:

  ($a[0], $a[1], $a[2], $a[3], $a[4], $b) = /(\d+), (\d+), (\d+),
(\d+), (\d+), Powerball: (\d+)/;

This puts the first five numbers into the array @a, and puts the
powerball number into scalar $b.

Note that this tackles a single line of data.  To get everything,
cycle through the lines using a "while (<DATA>)" and push the results
onto the two arrays as you get them:

  push @common, @a; push @powerball, $b;

In whole, you get:

  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;
  }

When you're done, @common is (22, 29, 35, 46, 52, 1, 31, 38, 40, 53,
6, 16, 18, 29, 37), and @powerball is (2, 42, 24).

-- 
Jonathan "Dataweaver" Lang

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


Reply via email to