#!/usr/bin/perl my $word; my @words = qw/relscta pnlkiyof mxieoc blna5oyb rilgbale rteceha rwrorai eeolit swabmtee dramse/; #chomp(@words=split/\s+/,); foreach $word (@words) { open LIST,"wordlist.txt"; @chars = split//,$word; @schars = sort(split//,$word); while() { chomp; chop; @wchars = split//; @swchars = sort(split//); $a=$#chars+1; $b=$#wchars+1; if($a==$b) { for($i=0;$i<=$a && $stop!=1;$i++) { if ($schars[$i] ne $swchars[$i]) { $stop=1; #print "\$stop is $stop.\n"; } if($stop!=1 && $i==$a) { print @wchars; print ","; } } } $stop=0; #print "\$stop is $stop.\n"; } close LIST; } print "\n";