#!/usr/bin/perl -w use strict; my ($line,$sortline); my $allowliteral=0; $allowliteral=shift @ARGV if(@ARGV and "-l" eq $ARGV[0]); die "usage: $0 [-l] \n" unless(1==@ARGV and $ARGV[0] =~ /^[a-z]+$/i); my $word=lc($ARGV[0]); my $sortword=join("",sort split //,$word); open(DICT,"<",($ENV{DICT} or "/usr/share/dict/words")) or die "open: $!"; while(defined($line=)) { chomp $line; next unless(length($line)==length($word)); $sortline=join("",sort split //,lc($line)); next unless($sortline eq $sortword); next if(lc($line) eq lc($word) and not $allowliteral); print "$line\n"; } close(DICT) or die "close: $!"; 0;