Skip to content

little word game in the makes! + perl code

Back when I interned at Shodor, I built a little word unscramble app that would be used to teach up coming high schoolers how easy it is to develop iOS applications. Though, they just viewed a document which had most of th code written for them, everyone seemed to enjoy learning how to develop an app.

After completing this little app, I alway wish I could publish it myself because I thought it was just entertaining enough to get a few downloads. Ever since that day, I longed for my own original word based game. Well almost 2 years later, my own idea has surfaced. I can’t give too much details at the moment but I did start it today.

First I did some research to find a good list of words. Luckily, I stumbled upon the this wiki-page. This should point you in the right direction if you are in need of a word list for your own app.

In any case, my app requires a certain character length for the word to be useful in this game. So I wrote a quick perl script. Suppose I only want words that are 10 letters long, heres code for that:

[code]
#!/usr/bin/perl

open(FILE, "mhyph.txt") or die("file does not exist");

@data = <FILE>;
close(FILE);

foreach $line (@data){
if (length $line == 10) {
print $line ."\n";
}
}
[/code]

this only prints out via terminal, so I run to put it into its own file

[code]perl script.prl > output.txt[/code]

Anyways, thought I would share what’s going on and hopefully i’ll have a new app out in the near future.

If you know a better approach to my perl script, i’d love for you to post it in the comments below. I always enjoy learning new ways of coding something.