On Mar 10, 2006, at 5:57 PM, Alan Burch wrote:
> f = File.open("./words")
> begin
>   while f.gets
>     if $_.length == 11
>       ar = $_.split(//)
>       if ar.uniq! == nil
>         print "#{ar.to_s}"
>       end
>     end
>   end
> rescue EOFError
>   f.close
> end

I'm guessing that

	print "#{ar.to_s}"

is what is slowing you down. It results in converting
each element of the array into a string (at least 11
extra method calls) and then concatenating the results.
Kind of a waste when you've got the result already sitting in $_.

Also, calling to_s to convert an object to a string within a string  
interpolation
block is redundant.

	print "#{ar}"

works and then you realize that you don't need the interpolation so

	print ar

is even better.  Understanding this is what David Black called a
'Ruby right of passage'.  At least I think it was David who said that
recently.  I'm too lazy to google for the reference at the moment.


Gary Wright