#!/usr/bin/perl
#
# convert a file from space-delimited to comma-delimited
#   just quick and dirty, not general case
#
# MWR 8/27/2025

use POSIX;
$debug = 1;


while (<STDIN>) {
  $line = $_;
  if ($line =~ /^#/) {
    printf "%s", $line;
    next;
  }

  @words = split(/\s+/, $line);
  $start = 0;
  if (($words[0] eq "") || ($words[0] eq " ")) {
    $start = 1;
  }
  for ($i = $start; $i <= $#words; $i++) {
    printf " %s ,", $words[$i];
  }
  printf "\n";

}



exit 0;

