#!/usr/bin/env perl # mkjt: script to turn an unformatted list of words into a jt quiz file. # Considers ';' to be a comment-to-end-of-line character, and '#' to be # an optional British-only marker at the end of a word. # See also: The 'jt' script, elsewhere in this directory. use strict; my %sols = (); while(<>) { chomp; s/;.*$//; s/\s*$//; foreach(split) { my $markedword = $_; s/#$//; push @{$sols{ join('', sort split //) }}, $markedword; } } print lc, " ", uc join(' ', @{$sols{$_}}), " -\n" foreach (sort keys %sols);