## Section 2 ## Break the section into lines my @section2 = split "\n", $sections[ 1 ]; ## discard header lines; shift @section2 for 1 .. 3; ## Away ## Construct the format from the header my $fmt = buildFmt( shift @section2 ); ## Use it to parse the Away player game stats my @awayStats; push @awayStats, [ unpack $fmt, shift @section2 ] while $section2[ 0 ] =~ m[\S]; print "@$_" for @awayStats; ## Discard blank lines shift @section2 while $section2[ 0 ] !~ m[\S]; ## Away totals ... same two steps again $fmt = buildFmt( shift @section2 ); my @awayTotals = unpack $fmt, shift @section2; print "@awayTotals"; ## Discard blank lines shift @section2 while $section2[ 0 ] !~ m[\S]; ## home ... and again $fmt = buildFmt( shift @section2 ); ## They could vary. my @homeStats; push @homeStats, [ unpack $fmt, shift @section2 ] while $section2[ 0 ] =~ m[\S]; print "@$_" for @homeStats; ## Discard blank lines shift @section2 while $section2[ 0 ] !~ m[\S]; ## Home totals ... and again $fmt = buildFmt( shift @section2 ); my @homeTotals = unpack $fmt, shift @section2; print "@homeTotals";