The DSIMMS graphing app was developed with Active State Perl, because cygwin did not have the needed perl libs, and the cygwin perl CPAN module could not install the needed libs, specifically GD::Graph.

Perl is really hideous in a lot of ways, but it gets the job done. I guess that is the reason why people like myself still use it. Here is a snippet of
code where we read from a binary data file and store it into a data structure that can be used by GD::Graph:

# $state keeps track of what variable we are look at.  Ideally this value 
# should be determined by reading the config file, for now we say 0 = x axis 
# label, 1 = x, 2 = y, 3 = z.
my $state = 0;
my $value;
my @data;
while (sysread(FD, $value, 2)) {
  # Update the index of the data structure.  When graphed this will be
  # the values for the x axis.  Ideally we will parse the file name as
  # well as the config file to determine start time and time between
  # data points.  For now we just have an index that increments from 
  # 0 onwards.
  if ($state == 0) {
    $data[$state]->[$#{$data[$state]}+1] = 
      defined($data[$state]->[$#{$data[$state]}]) ?
        $data[$state]->[$#{$data[$state]}]+1 : 0;
    $state++;
  }

  # Unpack the binary value and store it in our data structure.
  # Each binary value is 16 bit integer.
  $data[$state]->[$#{$data[$state]}+1] =
    unpack('S', $value);

  if ($verbose) {
    print STDERR "\$state: $state\n";
  }
  # Wrap back the state tracker.
  $state = ($state == 3) ? 0 : $state+1;
}
Skills: