Skip to content

Instantly share code, notes, and snippets.

@lukasvermeer
Created December 18, 2015 20:50
Show Gist options
  • Save lukasvermeer/74ae60efde25ee2ff68c to your computer and use it in GitHub Desktop.
Save lukasvermeer/74ae60efde25ee2ff68c to your computer and use it in GitHub Desktop.
Quick hack to find 7-letter words that are also two 4-letter words that share the first/last letter. (Needed that for a puzzle ...).
use strict;
use warnings;
use Data::Dumper;
open(W, "woorden.txt");
my %w;
while (my $line = <W>) {
chomp($line);
if (length $line == 4) {
$w{lc($line)} = 1;
}
if (length $line == 7) {
next unless substr($line,3,1) eq 'r';
$w{lc($line)} = 1;
}
}
close(W);
for my $word (keys %w) {
next unless length $word == 7;
next unless $w{substr($word,0,4)};
next unless $w{substr($word,3,4)};
print $word. "\n";
}
@lukasvermeer
Copy link
Author

Using Dutch dictionary:

Max:Desktop lukas$ perl find_word.pl | sort
amara's
amerika
amira's
amoreel
behrens
beuring
bierens
boering
courage
daaruit
deurens
deuring
dierick
diorama
dioriet
dooreen
dooreet
ekeraar
emiraat
everaar
everink
fierens
fiering
flora's
florens
florent
florian
florien
florijn
florist
geurink
giering
haaring
heering
heerink
heeroma
heeroom
hieruit
keuring
kierans
leeraar
leering
leerink
leurink
maarens
meereed
meereis
meerijd
meerook
mooring
oberink
overeen
overeet
overink
roerade
roering
roerink
sieraad
sierink
soera's
sparing
staring
starink
storing
teering
teerink
toereik
toeriep
toering
toerist
toeroep
toerust
viering
voerens
voering
vooruit
waaruit
weering
weerink
wierook
zeeramp
zeereep
zeereis
zeeroof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment