#!/usr/bin/perl -w #< th: look up a word in the thesaurus # See http://www.gutenberg.org/dirs/etext02/mthes10.zip for source. use strict; my @a; my $fh; my $thesaurus = "/usr/local/share/dict/mthesaur.txt"; my $arg = shift @ARGV || die "I need a word to look for.\n"; open($fh, "/usr/local/bin/look $arg $thesaurus |") || die "$thesaurus"; while (<$fh>) { chomp; @a = split(/,/, $_); print "$a[0]\n"; shift(@a); foreach (@a) { print " $_\n"; } print "\n"; } close($fh); exit(0);