in reply to parsing question

First off you need to make sure you have permission to use the copyrighted material you linked to. I would use unpack.

use strict; use warnings; use Data::Dumper; my @fields = qw/num name G A plus S PIM MIN MAJ ten GM GR MT PPG SH +G GWG OTG UAG ENG FG/; my $pattern = "A3 A21 A4 A5 A5 A5 A5 A5 A5 A5 A5 A5 A5 A5 A5 + A5 A5 A5 A5 A5"; my @data; while (my $line = <DATA>) { chomp($line); next if ($line !~ /^\d+ /); my %hash; @hash{@fields} = unpack($pattern,$line); # unpack the data accordi +ng to the pattern push(@data,\%hash); } print Dumper \@data; ## UPDATE: Reformated code

grep
XP matters not. Look at me. Judge me by my XP, do you?

Replies are listed 'Best First'.
Re^2: parsing question
by ikegami (Patriarch) on Dec 07, 2006 at 06:54 UTC

    First off you need to make sure you have permission to use the copyrighted material you linked to

    Copyright doesn't protect statistics. It does copy documents containing statistics (such as the linked text file), but we're not making a copy of the text file[*].

    There could be contractual (licensing, Terms of Service) issues, but no Copyright issues.

    * — Well, technically the file is copied numerous times (e.g. from the TCP stream into RAM), but Copyright allows those copies since they are necessary steps to viewing the file.