#!/usr/bin/perl
# 
# Replace all numerical values with the logarithm of the value.
#
# MWR 1/8/2026

use POSIX;

#$infile = "./mwr_jan07_2026.dat";
$infile = "./stu_jan12_2026.dat";
open(INFILE, "$infile") || die("can't open file $infile");
while (<INFILE>) {
  $line = $_;
  if ($line =~ /^#/) {
    printf "%s", $line;
    next;
  }
  if ($line =~ /^$/) {
    printf "%s", $line;
    next;
  }
  chomp($line);

  @words = split(/\s+/, $line);
  if ($#words < 1) {
    printf "%s\n", $line;
    next;
  }

  if ($debug > 0) {
    printf " line is ..%s.. has %d words \n", $line, $#words;
  }

  for ($i = 1; $i <= $#words; $i++) {
    $new = log10($words[$i]);
    if ($debug > 0) {
      printf " orig %7.2f  log %8.3f \n", $words[$i], $new;
    }
    printf " %8.3f ", $new;
  }
  printf "\n";




}

exit 0;
