in reply to Sort ofa Print Problem
Your sort method is making sure that all the empty lines in your input file are being grouped at the end of the "@stats" array, and your approach to printing with brackets or parens around certain columns applies equally to data and to empty lines.
As a funny coincidence, the number of lines with actual stats seems equal to the number of blank lines in the file.
See if it helps to add this line, just before the "chomp", inside the "foreach" loop:
(Update: normally, one would use "next" instead of "last" here, but since the lines are sorted with blanks at the end...)last if ( $i =~ /^\s*$/); # skip lines that are whitespace only
|
|---|