#!/usr/bin/perl -w use strict; # Lately everyone's been caught up in Powerball fever # (the jackpot is ~$280 million at time of writing), # so people around my office were starting to play, and # I wrote this to analyze the winning numbers history # text file that powerball.com offers. # (I promise that if I win, I'll donate heavily! :) my ( %numbers, %powerballs, %powerplays ); while ( <> ) { next if /^!.*$/; next if /^\s+$/; chomp( my @data = split / / ); my $date = shift @data; $powerplays{pop @data}++ if ( $#data == 6 ); $powerballs{pop @data}++; $numbers{$_}++ foreach @data; } open OUT, ">powerball.txt" or die "Can't open output file: $!"; print OUT < $numbers{$a} } keys %numbers ) { print OUT $_, "\t", $numbers{$_}, "\n"; } for ( 1..49 ) { print unless ( $numbers{ sprintf( "%02u", $_ ) } ); } print OUT < $powerballs{$a} } keys %powerballs ) { print OUT $_, "\t", $powerballs{$_}, "\n"; } for ( 1..42 ) { print unless ( $powerballs{ sprintf( "%02u", $_ ) } ); } print OUT < $powerplays{$a} } keys %powerplays ) { print OUT $_, "\t", $powerplays{$_}, "\n"; } close OUT;