#!/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 = sort(split//,$word); while() { chomp; chop; @wchars = sort(split//); $a=$#chars+1; $b=$#wchars+1; if($a==$b) { while($stop!=1) { for($i=0;$i<=$a && $stop!=1;$i++) { if ($chars->[$i] ne $wchars->[$i]) { $stop=1; } } print @chars; print "\t"; print @wchars; print "\n"; } } $stop=0; } print "\n"; close LIST; }