All pastes #205986 Raw Edit

maybe?

public text v1 · immutable
#205986 ·published 2006-10-17 04:53 UTC
rendered paste body
#!/usr/bin/perl

my $word;
my @words = qw/relscta pnlkiyof mxieoc blna5oyb rilgbale rteceha rwrorai eeolit swabmtee dramse/;

#chomp(@words=split/\s+/,<STDIN>);

foreach $word (@words)
{
	open LIST,"wordlist.txt";
	@chars = split//,$word;
	@schars = sort(split//,$word);

	while(<LIST>)
	{
		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";