#!/usr/bin/perl use strict; my %words; while (my $nextdic = shift) { open(FILE, "< $nextdic") or print(STDERR "Not Found $nextdic\n") && next; print STDERR "Cleaning $nextdic\n"; while (<FILE>) { chomp; s/ +//g; $words{$_} = "" } } print "$_\n" for (sort keys %words)