http://qs321.pair.com?node_id=911277


in reply to Find highest and lowest numerical values for columns in a file

Go trough the file and remember what is the smallest and largest number in each column. Something like this (untested):

my $min_col_2 = 1_000_000; # Something large enough my $max_col_2 = 0; # Something small enough my $min_col_3 = 1_000_000; # Something large enough my $max_col_3 = 0; # Something small enough while(<>){ if(/^ZZ/){ my @array = split; if($min_col_2 > $array[1]){ $min_col_2 = $array[1]; } if($max_col_2 < $array[1]){ $max_col_2 = $array[1]; } # Snip } }

To get the step size you also have to remember the second smallest number, and look at the difference between that and the smallest when you are done.

  • Comment on Re: Find highest and lowest numerical values for columns in a file
  • Download Code