Superdeluxe Automatic portmanteaus
June 18, 2007 1:50 AM
Subscribe
I want to make a couple of lists . It's a pretty simple format, but I have no idea how to go about it.
Here's the format I'm going for: I need to make portmanteaus. I want put in two source lists, of words or word parts, and come out with every possible portmanteau they will make. Here's an example, as that will probably help (no, this is not the real source data).
List A:
Super
Mega
Ultra
List B:
awesome
cool
deluxe
Output:
Superawesome
Megaawesome
Ultraawesome
Supercool
Megacool
Ultracool
Superdeluxe
Megadeluxe
Ultradeluxe
I need the output to be a text file, and I'm open to pretty much any solution that's easily automated. I have access to MS Office (on both systems), a PC runnning WinXP, and a Mac running OSX and Automator, but nothing else relevant (I don't think). I have no programming experience (no quick but messy way, sorry, as i'm up to about 100 words/wordparts on each list, and that's way too much to output manually.)
So how do I do it?
posted by The Esteemed Doctor Bunsen Honeydew to computers & internet (6 comments total)
1 user marked this as a favorite
use warnings;
use strict;
my @lista = qw/Super Mega Ultra/;
my @listb = qw/awesome cool deluxe/;
foreach my $b (@listb) {
foreach my $a (@lista) {
print "$a$b\n";
}
}
Save the above as a file doit.pl in your home directory on os x, open Terminal.app (in Applications/Utilities. run the command:
perl doit.pl > output.txt; open -t output.txt
tada, output appears in TextEdit.
posted by singingfish at 2:02 AM on June 18, 2007