#!/usr/bin/perl

$linenum = 0;
while (<>) {
  # print "$_";
  $linenum++;
  @line = split "\t";

  # printf("line number $linenum:\n");
  $wordnum = 0;

  foreach $word ( @line ) {
    # printf("  line[$wordnum] = $word \n");
    $wordnum++;
  }

  if ($line[1] > 0) {
    ### First line of that quartet:
    $rank    = $line[1];
    $quartet = $line[2];
    $song1   = $line[3];
    $score   = $line[8];
  } else {
    ### Second line of that quartet:
    $song2   = $line[3];

    ### Massage the data:
    $chapter =~ s/\(.*//;

    ### Print out info for this chorus:
    printf("  %2d  %4.1f%%  %s\n", 
      $rank, $score, $quartet, );
  }

}
