Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Solve Word Ladders

by Lexicon (Chaplain)
on Nov 24, 2001 at 15:40 UTC ( #127261=note: print w/ replies, xml ) Need Help??


in reply to Solve Word Ladders

I'd like to suggest this bugfix. I downloaded ENABLE and unziped and all. But for some reason my perl (5.6.0 and 5.6.1 on Mandrake 8.0) wouldn't read that file properly. It kept cutting off the last character of the words. I'm a bit out of practice on my Perl, so I havn't deciphered the reason, but this fixed it for me.

By the way, thanks a ton for this program. I'm writing a short story spoof of Alice based on word ladders for a class, and I need this program to produce lots of ladders for me. At least, if my idea pans out. Perhaps if the story is any good, I'll put up a link, though it will have little to do with Perl. ;)

# This is around line 40 # Insert this where the second 'my @wordlist;' is declared. my @wordlist; while (<WORDS>) { $_ =~ /(\w*)/; $_ = $1; push @wordlist, $_ if length $_ == length $word[0]; } close (WORDS);


Comment on Re: Solve Word Ladders
Download Code
Re: Re: Solve Word Ladders
by chipmunk (Parson) on Nov 26, 2001 at 01:36 UTC
    I'm glad to hear that you've found this program useful!

    Regarding your bug report, it sounds like the word file has Windows line endings rather than Unix line endings. chomp removes the linefeed, but not the carriage return, screwing up the length of the line. Try removing carriage returns from the word file: perl -pi -e 'tr/\r//d' wordlist

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://127261]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2014-08-01 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (32 votes), past polls