in reply to Parsing a Text File
its obvious you want a bunch of this data... you could do something like this.
Now $data{PITCHING} holds a ref to an array of all the lines in the PITCHING section... etc, etc... that help?my %data; my $latest = ''; while(<INPUT>) { chomp; if(/^([A-Z]+)\s*/) { #a line with all caps... new section $latest = $1; #what section are we in next; #go to next line } if($latest) { ## Next line handles $data{$latest} as an anonymous ## array, allowing you to store all the lines for ## each section that way push @{$data{$latest}}, $_; #just puts the line in, you could proc +ess it somehow } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing a Text File
by buckaduck (Chaplain) on Apr 12, 2001 at 01:21 UTC | |
by suaveant (Parson) on Apr 12, 2001 at 16:19 UTC |