You are on page 1of 51

CONTENTS

1 INTRODUCTION 1
1.1 ANAGRAM ENGINE 1
1.2 DEFINITIONS OF ANAGRAM 1
1.3 HISTORY 2
1.4 SOME FACTS TO ITS RELEVANCE 3
1.4.1 PANAGRAM 3
1.4.2 AMBIGRAM 3
1.4.3 BLANAGRAM 5
1.4.4 PALINDROME 5
1.4.5 SCRABBLE 7

2 AIM 9
2.1 PERMUTATION 9
2.2 COUNTING PERMUTATIONS 10
2.3 DICTIONARY 11
2.3.1 TYPES OF DICTIONARIES 12
2.3.2 ANAGRAM DICTIONARY 13
2.3.3 ONLINE DICTIONARY 14
2.4 SCOPE 14
2.4.1 ASTRONOMY 14
2.4.2 PSEUDONYMS 15
2.4.3 GAMES AND PUZZLES 16
2.4.4 ANAGRAMMATIC POEM 16
2.4.5 DICTIONARY ATTRIBUTE 17
2.4.6 CRYPTIC CROSSWORD 17
2.4.7 SECURITY AND ENCRYPTION 24
2.4.7.1 SKYPE SOFTWARE 24

3 MATERIALS AND METHODS 26


3.1 PLATFORM 26
3.2 OVERVIEW 26
3.3 FEATURES 27
3.4 DESIGN 27
3.5 APPLICATION 29
3.6 IMPLEMENTATION 30

1
3.7 DISCUSSIONS 31

3.7.1 ARE THERE ANY UNUSUAL VARIETIES OF


ANAGRAMS? 31
3.7.2 WHAT IS THE LONGEST ONE-WORD ANAGRAM?

32
3.7.3 WHAT SET OF LETTERS HAS THE MOST ONE-WORD
ANAGRAMS? 33

3.7.4 WHAT IS THE POINT OF ANAGRAMS? 33


3.7.5 HOW DO YOU CREATE ANAGRAMS? 34
3.7.6 WHAT ARE THE HALLMARKS OF A GOOD ANAGRAM?
35
3.7.7 SKETCH OF ALGORITHM 38
3.7.8 METHOD (CONTD.) 39

4 RESULT 41
4.1 PROGRAM RUN 41
4.2 PERFORMANCE ANALYSIS 42
4.2.1 A SLOW ALGORITHM 42
4.2.2 A FAST ALGORITHM 42
4.3 PLATFORM USAGE 43
4.3.1 PERMUTATION.C 43
4.3.2 DICTIONARY.C 43
4.3.3 FUSE.C 44
4.3.4 RESULTANT 44

5 SUMMARY 45
5.1 CONCLUSIONS 46

6 BILBIOGRAPHY/REFERENCES 47

2
1. INTRODUCTION

1 . 1 T H E A N AG R AM E N G I N E

Most anagram programs try to "guess" the anagrams you'll like.


Some of them even do a good job, picking out rude or funny
words. But the specialt y of the An agram Engine is it puts you
in control. It is able to solve and create anagrams in a way that
automatic systems simply can't. It's like the forensic expert of
anagrams!

Its incredible number-crunching power is able to calculate all


the permutations of words in your phrase, not just a small
selection. But it can return a lot of anagrams. If your name is
30 letters long, it could easil y generate over a million
anagrams! This is just too many to manage, so there are some
option settings to provide you with a way to filter your results
and control the engine. This wa y you can zoom-in on the best
anagrams, and this page describes how to do it.

1 . 2 D E F I N I T I O N S O F AN A G R AM

A word that is spelled with the exact same letters as another


word.
Example: RIDES is an anagram of SIRED and vice versa.

L i t e r a l l y, t h i s m e a n s t h e l e t t e r s o f a w o r d a r e r e a d b a c k w a r d s .
Can also refer to the change of one word into another by the
transposition of letters. Often, the letters of a word read out of
order to discover hidden meaning.

Word formed by rearranging the letters of another word; 'lager'


is an anagram of 'regal', as too is 'large'.

An anagram (Greek ana- = "back" or "again", and graphein = "to


write") is the result of permuting the letters of a word or words
in such a manner as to produce other words that possess

3
linguistic meaning. The meaning of the new word so created is
seen in the context of or in contrast to that of the old word so
as to create humorous or interesting associations between the
t w o . A n a g r a m s a r e a t yp e o f w o r d p l a y.

1 . 3 H I S T O RY

The construction of anagrams is an amusement of great


antiquity. They were popular throughout Europe during the
Middle Ages, although it is widely believed the art of
a n a g r a m m i n g w a s i n v e n t e d b y t h e G r e e k p o e t L yc o p h r o n .

W. Camden (Remains, 7th ed., 1674) defines


"Anagrammatisme" as "a dissolution of a name truly written into
his letters, as his elements, and a new connection of it by
artificial transposition, without addition, subtraction or change
o f a n y l e t t e r, i n t o d i f f e r e n t w o r d s , m a k i n g s o m e p e r f e c t s e n s e
appl y able (i.e., applicable) to the person named." Dryden
disdainfully called the pastime the "torturing of one poor word
ten thousand wa ys" but many men and women of note have
found amusement in it.

A well-known anagram is the change of "Ave Maria, gratia


p l e n a , D o m i n u s t e c u m " ( H a i l M a r y, f u l l o f g r a c e , t h e L o r d [ i s ]
with you) into "Virgo serena, pia, munda et immaculata"
(Serene virgin, pious, clean and spotless). Among others are
the anagrammatic answer to Pilate's question, "Quid est
v e r i t a s ? " ( W h a t i s t r u t h ? ) , n a m e l y, " E s t v i r q u i a d e s t " ( I t i s t h e
man who is here); and the transposition of "Horatio Nelson" into
"Honor est a Nilo" (Latin = Honor is from the Nile); and of
"Florence Nightingale" into "Flit on, cheering angel". James I's
courtiers discovered in "James Stuart" "a just master", and
converted "Charles James Stuart" into "Claims Arthur's seat"
(even at that point in time, the letters I and J were more-or-less
interchangeable).

"Eleanor Audeley", wife of Sir John Davies, is said to have


been brought before the High Commission in 1634 for
extravagances, stimulated by the discovery that her name could
be transposed to "Reveale, O Daniel", and to have been
laughed out of court by another anagram submitted by the dean
of the Arches, "Dame Eleanor Davies", "Never soe mad a
ladie".

4
1 . 4 S O M E FAC T S TO I T S R E L E VAN C E

1 . 4 . 1 PAN G R AM

A pangram is a short sentence containing all 26 letters of the


alphabet. Some reserve the term for sentences containing
exactly 26 letters, sometimes referred to as perfect pangrams.
By our definition of an anagram, all letters must be used once
and only once, so only a 26-letter pangram is an anagram of
the English alphabet.

The most well-known pangrams are these:

• The quick brown fox jumps over a lazy dog.


• Pack my box with five dozen liquor jugs.
• T h e f i v e b o x i n g w i z a r d s j u m p q u i c k l y.

E a c h i s s h o r t e r t h a n t h e l a s t , b u t l e t t e r s a r e s t i l l r e p e a t e d . To
arrive at a perfect pangram, the use of obscure foreign words
and abbreviations is often required, as seen in these examples:

• T V q u i z d r a g n ym p h b l e w J F K ' s c o x .
• C wm fjord-bank gl yphs vext quiz.

1 . 4 . 2 AM B I G R AM

An ambigram, also sometimes known as an inversion, is a


graphical figure that spells out a word not only in its form as
presented, but also in another direction or orientation. Douglas
R. Hofstadter describes an ambigram as a "calligraphic design
that manages to squeeze two different readings into the
selfsame set of curves." The first published reference to the
t e r m w a s b y H o f s t a d t e r, w h o a t t r i b u t e s t h e o r i g i n o f t h e w o r d t o
a f r i e n d . T h e 1 9 9 9 e d i t i o n o f H o f s t a d t e r ' s G ö d e l , E s c h e r, B a c h
f e a t u r e s a 3 - D a m b i g r a m o n t h e c o v e r.

5
AM B I G R AM T Y P E S

Ambigrams usually fall into one of several categories:

Rotational
A design that presents several instances of words when
rotated through a fixed angle. This is usually 180 degrees,
but rotational ambigrams of other angles exist, for
example 90 or 45 degrees. The word spelled out from the
alternative direction(s) is often the same, but may be a
different word to the initiall y presented form. A simple
example is the lower-case abbreviation for "Down", dn,
which looks like the lower-case word up when rotated 180
degrees.
Mirror
A design that can be read when reflected or viewed
t h r o u g h a m i r r o r, u s u a l l y a s t h e s a m e w o r d o r p h r a s e b o t h
wa ys, but not always.
Figure-ground
A design in which the spaces between the letters of one
word form another word.
Chain
A design where a word (or sometimes words) are
interlinked forming a repeating chain. Letters are usually
overlapped meaning that a word will start partway through
another word. Sometimes chain ambigrams are presented
in the form of a circle.
Space-filling
Similar to chain ambigrams, but tile to fill the 2-
dimensional plane.
3-dimensional
A design where an object is presented that will appear to
read several letters or words when viewed from different
angles. Such designs can be generated using constructive
solid geometry.
Perceptual shift
A d e s i g n w i t h n o s ym m e t r y b u t c a n b e r e a d a s t w o
different words depending on how the curves of the letters
are interpreted.

6
Natural
A natural ambigram is a word that possesses one or more
o f t h e a b o v e s ym m e t r i e s w h e n w r i t t e n i n i t s n a t u r a l s t a t e ,
a n d r e q u i r i n g n o t yp o g r a p h i c s t y l i n g . F o r e x a m p l e t h e
words "dollop", "suns" and "solos" are natural rotational
ambigrams. The word "bud" forms a natural mirror
ambigram when reflected h o r i z o n t a l l y. The word
"CHOICE", in all capitals, forms a natural mirror ambigram
w h e n r e f l e c t e d v e r t i c a l l y.

Ambigrams are exercises in graphic design that play with


o p t i c a l i l l u s i o n s , s ym m e t r y a n d v i s u a l p e r c e p t i o n . A m b i g r a m
lovers value especially those with a relation between form and
content.

Ambigrams feature prominently in Dan Brown's novel, Angels


and Demons, of which the first UK release featured an
a m b i g r a m o f t h e t i t l e o n t h e c o v e r. T h e a m b i g r a m s i n t h e n o v e l
were designed by graphic artist John Langdon. Since the
release of the bestseller sequel The Da Vinci Code , there has
been a marked increase in the popularity and awareness of
ambigrams, and this has led to a reprint of John Langdon's
book on ambigrams entitled Wordplay.

1 . 4 . 3 B L AN AG R AM

A blanagram (from blank+anagram) is a word which is an


a n a g r a m o f a n o t h e r b u t f o r t h e s u b s t i t u t i o n o f a s i n g l e l e t t e r.
The term has its origin in competitive Scrabble, where a blank
t i l e o n a p l a ye r ' s r a c k m a y b e u s e d t o f o r m a n y o f s e v e r a l
possible words in conjunction with the player's other tiles.

1 . 4 . 4 PAL I N D R O M E

A palindrome is a word, phrase, number or other sequence of


units that has the property of reading the same in either
direction (the adjustment of punctuation and spaces between
words is generally permitted).

T Y P E S O F PAL I N D R O M E

7
Symmetry by characters

The most familiar palindromes, in English at least, are


c h a r a c t e r - b y- c h a r a c t e r : t h e w r i t t e n c h a r a c t e r s r e a d t h e s a m e
backwards as forwards. Palindromes may consist of a single
word (such as "civic" or "level" ), a phrase or sentence ("Neil, a
trap! Sid is part alien!"), or a longer passage of text ("Sit on a
potato pan, Otis.") Some other examples are "Do geese see
G o d ? " , " M r. O w l a t e m y m e t a l w o r m . " a n d " G o h a n g a s a l a m i , I ' m
a lasagna hog." Spaces, punctuation and case are usually
ignored.

Three famous English palindromes are: "Able was I ere I saw


Elba," honoring the first exile of Napoleon; "A man, a plan, a
c a n a l : P a n a m a , " ( b y L e i g h M e r c e r, c o m m e m o r a t i n g T h e o d o r e
Roosevelt or Ferdinand Lesseps), and "Madam, in Eden I'm
Adam," (a reference to the creation story in the Bible). (This
last example is still palindromic if "in Eden" is omitted. The
response would be a one-word palindrome, "Eve.")

A famous palindrome sentence in Portuguese is "Socorram-me,


subi no onibus em Marrocos" which means "Help me, I took a
bus in Morocco."

Symmetry by words

Some palindromes use words as units rather than letters. An


example is "fall leaves after leaves fall" or "First Ladies rule
the State and state the rule: ladies first". The Chinese
palindromes described above are most like this type of English
palindrome.

Symmetry by lines

Still other palindromes take the line as the unit. The poem
D o p p e l g a n g e r, c o m p o s e d b y J a m e s A . L i n d o n , i s a n e x a m p l e .

The dialogue "Crab Canon" in Douglas Hofstadter's Gödel,


E s c h e r, B a c h i s n e a r l y a l i n e - b y- l i n e p a l i n d r o m e . T h e s e c o n d
half of the dialog consists, with some very minor changes, of
the same lines as the first half, but in reverse order and spoken
by the opposite characters (i.e., lines spoken by Achilles in the
f i r s t h a l f a r e s p o k e n b y t h e To r t o i s e i n t h e s e c o n d , a n d v i c e
v e r s a ) . I n t h e m i d d l e i s a n o n - s ym m e t r i c a l l i n e s p o k e n b y t h e
Crab, who enters and spouts some nonsense, apparently
triggering the reversal. The structure is modeled after the

8
musical form known as crab canon, in particular the canon a 2
c a n c r i za n s o f J o h a n n S e b a s t i a n B a c h ' s T h e M u s i c a l O f f e r i n g .

1 . 4 . 5 S C R AB B L E

Scrabble is a popular word game and board game in which 2 to


4 players score points by forming words from individual lettered
t i l e s o n a 1 5 - b y- 1 5 g a m e b o a r d . T h e w o r d s a r e f o r m e d a c r o s s
and down in crossword fashion, and must appear in a standard
dictionary. Official reference works (e.g. The Official Scrabble
Players Dictionary, now in its 4th edition) that provide a list of
permissible words, some of which are rarely found in standard
English writing, are also available.

The name Scrabble is a trademark of Hasbro, Inc. in the US


a n d C a n a d a a n d o f J . W. S p e a r & S o n s P L C e l s e w h e r e .
Scrabble was a trademark of Murfett Regency in Australia, until
1 9 9 3 w h e n i t w a s a c q u i r e d b y S p e a r. T h e g a m e i s a l s o k n o w n
as Alfapet, FUNWORDER, S k i p - A- C r o s s and Palabras
Cruzadas.

The game is sold in 121 countries in 29 different language


versions. Worldwide, one hundred million sets have been sold,
and sets are found in one out of every three American homes.

The game was created by architect Alfred Mosher Butts in


1938, as a variation on an earlier word game he invented called
Lexiko. The two games had the same set of letter tiles, whose
distributions and point values Butts worked out meticulously by
counting letter usage from the various sources including The
N e w Yo r k T i m e s . T h e n e w g a m e , w h i c h h e c a l l e d " C r i s s -
Crosswords", added the 15-by-15 game board and the
c r o s s w o r d - s t yl e g a m e p l a y.

In 1948, lawyer James Brunot, a resident of Newtown,


Connecticut, bought the rights to manufacture the game in
exchange for granting Butts a royalty on every unit sold.
Though he left most of the game (including the distribution of
letters) unchanged, Brunot slightly rearranged the "premium"
squares of the board and simplified the rules; he also changed
the name of the game to "Scrabble", a real word which means
" t o g r o p e f r a n t i c a l l y, " a n d s o l d s e t s t o , a m o n g o t h e r c u s t o m e r s ,

9
Macy's department store, which created a demand for the
game.

N O TAT I O N S Y S T E M

I n t h e n o t a t i o n s ys t e m c o m m o n i n t o u r n a m e n t p l a y, c o l u m n s a r e
labeled "A-O" and rows "1-15". A play is usually identified in
the format xy WORD score or WORD xy score, where: x
d e n o t e s t h e c o l u m n o r r o w o n w h i c h t h e p l a y' s m a i n w o r d
extends; y denotes the second coordinate of the main word's
f i r s t l e t t e r, a n d W O R D i s t h e m a i n w o r d . A l t h o u g h u n n e c e s s a r y,
additional words formed by the play are occasionally listed
after the main word and a slash. In the case where the play of
a single tile formed words in each direction, one of the words is
arbitrarily chosen to serve as the main word for purposes of
notation.

When a blank tile is employed in the main word, the letter it


has been chosen to represent is indicated with a lower case
l e t t e r, o r, i n h a n d w r i t t e n n o t a t i o n , w i t h a s q u a r e a r o u n d t h e
l e t t e r. P a r e n t h e s e s a r e s o m e t i m e s a l s o u s e d t o d e s i g n a t e a
blank, although this may create confusion with a second
(optional) function of parentheses, namely indication of an
e x i s t i n g l e t t e r o r w o r d t h a t h a s b e e n " p l a ye d t h r o u g h " b y t h e
main word.

10
2 AI M

Finding the possible anagrams of the particular input and to


output the string as an anagram to the desired input string.

The three important tasks performed through the program:

1. Permutation of the given string


2. Dictionary building with all possible combination of
words
3. Checking all the permuted values of the string with
the dictionary file of the presence of data.

2 . 1 P E R M U TAT I O N

P e r m u t a t i o n i s t h e r e a r r a n g e m e n t o f o b j e c t s o r s ym b o l s i n t o
distinguishable sequences. Each unique ordering is called a
permutation.For example, with the numerals one to six, each
possible ordering consists of a complete list of the numerals,
without repetitions. There are 720 total permutations of these
numerals, one of which is: "4, 5, 6, 1, 2, 3".

The general concept of permutation can be defined more


formally in different contexts:

• In set theory, a permutation is an ordered sequence


c o n t a i n i n g e a c h s ym b o l f r o m a s e t o n c e , a n d o n l y o n c e .
Neither "1, 2, 2, 3, 4, 5, 6" nor "1, 2, 4, 5, 6" are
permutations of the sequence "1, 2, 3, 4, 5, 6". A
permutation is distinct from a set or combination, in that
the ordering of elements in a set is not considered
relevant. In other words, the set-theoretic definition of
permutation is that of a one-to-one correspondence, or
bijection, of labeled elements with "positions" or "places"
which are arranged in a straight line.
• In finite geometry, permutative places may be arranged in
more geometrically complicated structures than a simple
straight line; for instance, a square. For examples, see
finite geometry of the square and cube.

11
• In abstract algebra and related areas, the elements of
permutation may not be arranged in a linear order, or
indeed in any order at all. Under this refined definition, a
permutation is a bijection from a finite set, X, onto itself.
This allows for the definition of groups of permutations;
see permutation group.
• In combinatorics, the term permutation also has a
traditional meaning which includes ordered lists without
repetition and where one or more elements from the list
are omitted from the distinguishable orderings; for
example, a permutation of "1,2,4,3" with "5" and "6"
omitted.

2 . 2 C O U N T I N G P E R M U TAT I O N S

I n t h i s s e c t i o n o n l y, t h e t r a d i t i o n a l d e f i n i t i o n i s u s e d : a
permutation is an ordered list without repetitions, perhaps
missing some elements. The number of permutations of a
sequence is:

where:

• r is the size of each permutation,


• n is the size of the sequence from which elements are
permuted, and
• ! i s t h e f a c t o r i a l o p e r a t o r.

For example, if we have a total of 10 elements, the integers {1,


2, ..., 10}, a permutation of three elements from this set is (5,
3 , 4 ) . I n t h i s c a s e , n = 1 0 a n d r = 3 . To f i n d o u t h o w m a n y
u n i q u e s e q u e n c e s , s u c h a s t h e o n e p r e v i o u s l y, w e c a n f i n d , w e
need to calculate P(10,3) = 720.

An easier way to compute this is to take the first r numbers of n


factorial; in this case: take the first 3 numbers in 10 factorial,
so you would have 10 times 9 times 8, which equals 720.

O t h e r, o l d e r n o t a t i o n s i n c l u d e n P r , P n , r , o r n P r . A c o m m o n
modern notation is (n)r which is called a falling factorial.
H o w e v e r, t h e s a m e n o t a t i o n i s u s e d f o r t h e r i s i n g f a c t o r i a l ( a l s o
called Pochhammer symbol)

n(n + 1)(n + 2)...(n + r − 1).

12
With the rising factorial notation, the number of permutations is
(n − r + 1)r.

2 . 3 D I C T I O N AR Y

The dictionary is a list of words with their definitions, a list of


c h a r a c t e r s w i t h t h e i r g l yp h s , o r a l i s t o f w o r d s w i t h
corresponding words in other languages. In a few languages,
words can appear in many different forms, but onl y the lemma
form appears as the main word or headword in most
dictionaries. Many dictionaries also provide pronunciation
information; grammatical information; word derivations,
h i s t o r i e s , o r e t ym o l o g i e s ; i l l u s t r a t i o n s ; u s a g e g u i d a n c e ; a n d
examples in phrases or sentences. Dictionaries are most
commonly found in the form of a book, but more and more
dictionaries are produced as software runs from electronic
PDA or a general purpose computer. Some dictionary software
are capable of speak out the word it contains, and so being
called talking dictionar y. Most dictionaries are produced by
lexicographers.

WORD ORDER

To d a y, d i c t i o n a r i e s o f m o s t l a n g u a g e s w i t h a l p h a b e t i c a n d
s y l l a b i c w r i t i n g s ys t e m s l i s t w o r d s i n l e x i c o g r a p h i c o r d e r,
usually alphabetical or some analogous phonetic system.

In many languages, words are grouped together according to


their true or normal origin ("root"), and these roots are
a r r a n g e d a l p h a b e t i c a l l y. I f E n g l i s h d i c t i o n a r i e s w e r e a r r a n g e d
like this, the words "import", "export", "support", "report",
"porter", "port", "important" and "transportation" would all be
listed under "port". This method has the advantage that all
w o r d s o f a c o m m o n o r i g i n a r e l i s t e d t o g e t h e r, b u t t h e
disadvantage is that one has to know how to recognize all
prefixes of a word before one can look it up. Some Hebrew,
S a n s k r i t , a n d A r a b i c d i c t i o n a r i e s w o r k t h i s w a y.

The main body of modern dictionaries of languages using the


Chinese logographic writing system, such as Chinese,
Japanese and Korean, is sorted phonetically: most Chinese
dictionary order entries according to the Latin alphabet with the

13
pin yin spelling, Japanese dictionar y use the order of the kana
s yllabic script, and Korean dictionaries use the hangul
alphabet. However the dictionary for these languages also
usually include a list of characters sorted in a non-phonetic
w a y, i n o r d e r t o a l l o w r e a d e r s t o f i n d w o r d s w r i t t e n i n
logograms whose pronunciation is not known. Chinese
characters may be sorted according to one of many schemes
based on the component parts of the characters (radicals,
number of strokes, overall shape).

The first English alphabetical dictionary came out in 1604 and


alphabetical ordering was a rarity until the 18th century. Before
alphabetical listings, dictionaries were organized by topic, i.e.
a list of animals all together in one topic

2 . 3 . 1 T Y P E S O F D I C T I O N AR I E S

The following titles will give you an idea of the variety of


d i c t i o n a r i e s a v a i l a b l e a t t h e L i b r a r y. T h e r e a r e m a n y m o r e .

Language dictionaries
Collins English dictionary
English-Zulu Zulu-English dictionary
Webster's third new international
dictionary of the English language
English-Xhosa dictionary
The Oxford dictionary of abbreviations
Dictionary of contemporary slang
A dictionary of English usage in Southern
Africa
Subject dictionaries
Dictionary of library terms
Dictionary of legal words and phrases
Dictionary of feminist theory
A dictionary of birds
Dictionary of applied ecology
Dictionary of advertising and marketing
A political and economic dictionary of
Africa
Biographical dictionaries
Dictionary of African biography

14
A biographical dictionary of artists
The biographical dictionary of scientists
An African biographical dictionary
Biographical dictionary of the Middle East

2 . 3 . 2 A N AG R AM D I C T I O N AR Y

In the main type of anagram dictionary, the letters in words or


p h r a s e s a r e r e a r r a n g e d i n a l p h a b e t i c a l o r d e r, a n d t h e s e
transpositions are themselves then ordered alphabetically
within word-length groups, so that any words consisting of this
group of letters can be found. This arrangement is designed for
u s e i n s o l v i n g w o r d p u z z l e s s u c h a s c r o s s w o r d s , o r f o r p l a yi n g
games such as Scrabble. The first such anagram dictionary was
t h e " C r o s s w o r d A n a g r a m D i c t i o n a r y" b y R . J . E d w a r d s , p u b l i s h e d
in 1978 b y Barrie & Jenkins in the UK and Ma yflower Books in
the US.

I n t h e o t h e r k i n d o f a n a g r a m d i c t i o n a r y, w o r d s a r e c a t e g o r i z e d
into equivalence classes that consist of words with the same
n u m b e r o f e a c h k i n d o f l e t t e r. T h u s w o r d s w i l l o n l y a p p e a r w h e n
other words can be made from the same letters.

Anagram dictionaries were formerly produced by hand, but can


now be trivially generated from any machine-readable word list
b y c o m p u t e r, b y s o r t i n g w o r d s i n o r d e r o f t h e i r s o r t e d l e t t e r -
strings.

2 . 3 . 3 O N L I N E D I C T I O N AR I E S

Dictionaries do not only appear in paper format. Many are also


a v a i l a b l e e l e c t r o n i c a l l y.

The examples below are online dictionaries.

Dictionary present online

Oxford English dictionary online


Cambridge dictionaries online

15
Language dictionaries, multi-lingual
dictionaries, specialty dictionaries, the
Endangered Language Repository - the
sanctuary for endangered languages on the
World Wide Web, and more
Online Medical & Science dictionaries
Oxford Reference Online

2.4 SCOPE

2.4.1 AS TRON OM Y

Perhaps the practical use to which anagrams have been turned


is to be found in the transpositions in which some of the
astronomers of the 17th century embodied their discoveries
with the design apparently of avoiding the risk that, while they
were engaged in further verification, the credit of what they had
found out might be claimed by others. Thus Galileo announced
h i s d i s c o v e r y t h a t Ve n u s h a d p h a s e s l i k e t h e M o o n i n t h e f o r m
" H a e c i m m a t u r a a m e i a m f r u s t r a l e g u n t u r - o y" ( L a t i n : T h e s e
immature ones have already been read in vain by me -oy), that
i s , w h e n r e a r r a n g e d , " C yn t h i a e f i g u r a s a e m u l a t u r M a t e r
A m o r u m " ( L a t i n : T h e M o t h e r o f L o v e s [ = Ve n u s ] i m i t a t e s t h e
f i g u r e s o f C y n t h i a [ = t h e m o o n ] ) . S i m i l a r l y, w h e n R o b e r t H o o k e
discovered Hooke's law in 1660, he first published it in
anagram form. One might think of this as a primitive example of
a zero-knowledge proof.

There are also a few "natural" anagrams, English words


unconsciously created by switching letters around. The French
chaise longue ("long chair") became the American "chaise
lounge" by metathesis (transposition of letters and/or sounds).
It has also been speculated that the English "curd" comes from
the Latin crudus ("raw").

2.4.2 PSEUDONYMS

T h e p s e u d o n ym s a d o p t e d b y a u t h o r s a r e o f t e n t r a n s p o s e d
forms, more or less exact, of their names; thus "Calvinus"
becomes "Alcuinus" (V = U); "Francois Rabelais" = "Alcofribas
N a s i e r " ; " A r r i g o B o i t o " = " To b i a G o r r i o " ; " E d w a r d G o r e y " =

16
"Ogdred Wear y", = "Regera Dowd y" or = "E. G. Dead worr y"
(and others); "Vladim ir Nabokov" = "Vi vian Darkbloom ", =
" V i v i a n B l o o d m a r k " o r = " D o r i a n V i v a l c o m b " ; " B r y a n Wa l l e r
Proctor" = "Barry Cornwall, poet"; "Henry Rogers" = "R. E. H.
G r e y s o n " ; " ( S a n c h e ) d e G r a m o n t " = " Te d M o r g a n " , a n d s o o n . I t
is to be noted that several of these are "imperfect anagrams",
letters having been left out in some cases for the sake of easy
pronunciation.

" Te l l i a m e d " , a s i m p l e r e v e r s a l , i s t h e t i t l e o f a w e l l k n o w n w o r k
b y " D e M a i l l e t " . O n e o f t h e m o s t r e m a r k a b l e p s e u d o n ym s o f t h i s
c l a s s i s t h e n a m e " Vo l t a i r e " , w h i c h t h e c e l e b r a t e d p h i l o s o p h e r
assumed instead of his family name, François Marie Arouet,
and which is now generally allowed to be an anagram of
" A r o u e t , l [ e ] j [ e u n e ] " ( U = V, J = I ) t h a t i s , " A r o u e t t h e y o u n g e r " .
Anagramming may also be used to good effect in farce or
parod y. A writer might take an unpleasant person he knows,
base a character in a book on him, and then transpose the
letters in the source's name.

2 . 4 . 3 G AM E S A N D P U Z Z L E S

A n a g r a m s a r e i n t h e m s e l v e s a r e c r e a t i o n a l a c t i v i t y, b u t a l s o
make up part of many other games, puzzles and game shows.

• I n S c r a b b l e , t h e p l a ye r s m u s t m a k e w o r d s b y p l a c i n g
lettered tiles on a grid to score points in an effort to have
scored more points than the opponent at the end of the
game. A version of Scrabble called Clabbers, the name
itself being an anagram of Scrabble, allows for tiles to be
placed in any order on the board as long as they anagram
to a valid word.

17
• I n B o g g l e , p l a ye r s m a k e w o r d s f r o m a g r i d o f s i x t e e n
random letters by joining adjacent cubes to make valid
words.

• On the British game show Countdown contestants are


given 30 seconds to make the longest word from nine
random letters. One point is awarded per letter of the
word, or 18 points for using all nine letters.

• O n t h e B r i t i s h g a m e s h o w B r a i n Te a s e r , c o n t e s t a n t s a r e
shown a word broken into randomly arranged segments
and must announce the whole word. At the end of the
game there is a "Pyramid" which starts with a three-letter
word. A letter appears in the line below to which the
p l a ye r m u s t a d d t h e e x i s t i n g l e t t e r s t o f i n d a s o l u t i o n . T h e
p a t t e r n c o n t i n u e s u n t i l t h e p l a ye r r e a c h e s t h e f i n a l e i g h t -
l e t t e r a n a g r a m . T h e p l a ye r w i n s t h e g a m e b y s o l v i n g a l l
the anagrams within the allotted time.
• In several newspapers across the United States people
figure out anagrams in the Jumble word search.

2 . 4 . 4 A N AG R AM M AT I C P O E M

An agrammatic poetr y is poetry wi th the constrained form that


either each line or each verse is an anagram of all other lines
or verses in the poem.

Writing anagrammatic poetry is a form of a constrained writing


similar to writing pangrams or long alliterations.

2 . 4 . 5 D I C T I O N AR Y AT T R I B U T E S

1. Meanings
2. Spellings
3. Adjectives
4. Adverbs
5. Conjunctions
6. Interjections
7. Nouns
8. Prepositions
9. Pronouns

18
1 0 . Ve r b s

The above given are the 10 conventional attributes of a


d i c t i o n a r y.

But in this as we can see that there is no such attribute called


ANAGRAM.

But now in a dictionary software which is found in the internet


also implements the anagram attribute for the users to check a
word in a dictionary and also have a reference to the anagram
o f t h a t p a r t i c u l a r w o r d w h i c h i s b e i n g l o o k e d f o r.

2 . 4 . 6 C RY P T I C C R O S S W O R D

Cryptic crossw ords are a particular type of crossword which


have become widely popular in the UK, and several other
Commonwealth nations such as Australia, New Zealand,
Canada and India. They are also popular in Israel in a Hebrew
form (where they are called "Logic crosswords"). Each
individual clue is a word puzzle in and of itself (often involving
anagrams).

Ty p e s o f c l u e

Pure cryptic

The original cryptic clue, more commonl y known as a double


entendre or cryptic definition. Clues of this sort appeared in
"straight" crosswords before cryptic crosswords existed. Here
the clue appears to say one thing, but with a slight shift of
v i e w p o i n t i t s a y s a n o t h e r. F o r e x a m p l e :

A word of praise? (8)

19
would give the answer ALLELUIA, a word used by Christians to
praise God, but not what first springs to mind on reading the
clue. Notice the question mark - this is often (though by no
means alwa ys) used by compilers to indicate this sort of clue is
one where you need to interpret the words in a different
fashion. The way that a clue reads as an ordinary sentence is
called its surface reading and is often used to disguise the
need for a different interpretation of the clue's component
words.

Another one might be:

The flower of London? (6)

which gives THAMES, a flow-er of London. Here, the surface


r e a d i n g s u g g e s t s a f l o w e r, w h i c h d i s g u i s e s t h e f a c t t h a t t h e
name of a river is required.

T h i s t yp e o f c l u e r a r e l y a p p e a r s i n A m e r i c a n c r yp t i c s , b u t i s
c o m m o n i n B r i t i s h a n d C a n a d i a n c r yp t i c s .

Double definition

A c l u e m a y, r a t h e r t h a n h a v i n g a d e f i n i t i o n p a r t a n d a w o r d p l a y
part, have two definition parts. Thus

Not seeing window covering (5)

would have the answer BLIND, because both "not seeing" and
"window covering" can mean blind. Note that since these
definitions come from the same root word, an American
magazine might not allow this clue. American double definitions
tend to require both parts to come from different roots, like in
this clue:

Eastern European buff (6)

This takes advantage of the two ver y different meanings (and


pronunciations) of POLISH, the one with the long "o" sound
meaning "someone from Poland" and the one with the short "o"
s o u n d m e a n i n g " m a k e s h i n y. "

T h e s e c l u e s t e n d t o b e s h o r t ; i n p a r t i c u l a r, t w o - w o r d c l u e s a r e
almost alwa ys double definition clues.

In the UK, multiple definitions are occasionally used e.g.

20
Burn milk making hot drink for clergyman (6)

is a triple definition of BISHOP ("mulled red wine flavoured with


bitter oranges", or "to burn milk in cooking" as well as the usual
meaning) - but in the US this would be considered unsound.

Hidden words

This is when the answer appears in the clue, but it is hidden


within one or more words. For example:

Found ermine, deer hides damaged (10)

gives UNDERMINED, which means (crypticall y at least)


"damaged" and can be found as part of "Found ermine deer".
The word "hides" is used to mean "contains," but in the surface
sense suggests "pelts".

P o s s i b l e i n d i c a t o r s o f a h i d d e n c l u e a r e " i n p a r t " , " p a r t i a l l y" ,


"in", "within", "hides", "conceals", "some", and "held by".

Another example:

Introduction to do-gooder canine (3)

gives DOG, which is the first part of, or "introduction to", the
word "do-gooder", and means "canine".

Reversals

A word that gets turned around to make another is a reversal.


For example:

Returned beer fit for a king (5)

The answer is REGAL. "Lager" (i.e., "beer") is "returned" to


make regal.

Other indicator words include "receding", "in the mirror", "going


the wrong wa y", "returns", "to the left" or "left" (for across
clues), and "rising", "overturned" or "mounted" or "comes up"
(for down clues).

21
Hidden backw ards

Sometimes the above two clue types are combined. A word may
be hidden backwards, such as in the clue:

Cruel to turn part of internet torrid (6)

The answer to this clue is ROTTEN. The phrase "to turn"


indicates "to reverse," and "part of" suggests a piece of
"internet torrid".

"Charade" clues

Here the answer is formed by joining individually clued words


t o m a k e a l a r g e r w o r d ( n a m e l y, t h e a n s w e r ) .

For example:

Outlaw leader managing money (7)

The answer is BANKING formed by BAN for "outlaw" and KING


f o r " l e a d e r " . T h e d e f i n i t i o n i s " m a n a g i n g m o n e y" . W i t h t h i s
example, the words go next to each other in the clue as they do
i n t h e a n s w e r - i t i s n ' t s p e c i f i c a l l y i n d i c a t e d . H o w e v e r, w h e r e
the parts go in relation to others is sometimes indicated with
words like "against", "after", "with" or (in a down clue) "above".

Containers

A c o n t a i n e r c l u e p u t s o n e s e t o f l e t t e r s i n s i d e a n o t h e r. S o :

Perfume cloth seen in European nation (9)

gives FRAGRANCE, placing "rag" ("cloth") inside "France"


("European nation").

Other container indicators are "around," "clutching," "enters,"


and the like.

An agrams

An anagram is a rearrangement of a certain section of the clue


t o f o r m t h e a n s w e r. T h i s i s u s u a l l y i n d i c a t e d b y w o r d s s u c h a s
'strange', 'bizarre', 'muddled', 'wild', 'drunk', or any other term
indicating change. One example might be:

22
Chaperone shredded corset (6)

g i v e s E S C O R T, w h i c h m e a n s c h a p e r o n e a n d i s a n a n a g r a m o f
corset, indicated by the word shredded.

Anagram clues are characterized by an indicator word adjacent


t o a p h r a s e t h a t h a s t h e s a m e n u m b e r o f l e t t e r s a s t h e a n s w e r.
The indicator tells the solver that there is an anagram they
n e e d t o s o l v e i n o r d e r t o w o r k o u t t h e a n s w e r. I n d i c a t o r s c o m e
either before or after the letters to be anagrammed. In an
A m e r i c a n c r yp t i c , o n l y t h e w o r d s g i v e n i n t h e c l u e m a y b e
anagrammed; in some older puzzles, the words to be
anagrammed may be clued and then anagrammed. So in this
clue:

Chew honeydew fruit (5)

c h e w i s t h e a n a g r a m i n d i c a t o r, h o n e y d e w c l u e s m e l o n , w h i c h i s
t o b e a n a g r a m m e d , a n d f r u i t i s t h e d e f i n i t i o n f o r t h e a n s w e r,
LEMON.

Other possible anagram indicators, among the thousands


possible: abstract, absurd, alien, alternative, awkward, bad,
b a r m y, b l e n d , b r e a k , c a r e l e s s , c h a o t i c , c l u m s y, c o n t r i v e d ,
c o n v e r t , c o r r u p t , d e v e l o p , d o c t o r, e c c e n t r i c , f a b r i c a t e , f a k e , f i x ,
f u d g e , g r o u n d , h a m m e r, h y b r i d , j o s t l e , k n e a d , l o o s e , m a y b e ,
m e s s y, m i x , m u t a n t , n e w, n o v e l , o d d , o r d e r, o u t , o u t r a g e o u s ,
p e c u l i a r, p o o r, q u e s t i o n a b l e , r e m o d e l , r e s o r t , r o u g h , s o r t ,
s t r a n g e , s t yl e , t r o u b l e d , t w i s t , u n c o n v e n t i o n a l , u n s o u n d , v a r y.

It is common for the setter to use a juxtaposition of anagram


indicator and anagram that form a common phrase, to make the
clue appear as much like a 'normal' sentence or phrase as
possible. For example:

Lap-dancing friend (3)

uses dancing as the indicator as it fits cohesively with lap to


g i v e t h e s o l u t i o n , PA L .

Homophones

Homophones are words that sound the same but have different
meanings, such as "night" and "knight". Homophone clues
always have an indicator word or phrase that has to do with

23
p h o n e t i c s , s u c h a s " r e p o r t e d l y" , " t h e y s a y" , " v o c a l " , " t o t h e
audience", "by the sound of it", and "is heard".

An example of a homophone clue is

We hear twins shave (4)

w h i c h i s a c l u e f o r PA R E , w h i c h m e a n s " s h a v e " a n d i s a
h o m o p h o n e o f p a i r, o r " t w i n s " . T h e h o m o p h o n e i s i n d i c a t e d b y
"we hear".

If the words are the same length, the homophone indicator is


always adjacent to the word that is not the answer; therefore,
in the previous example, "we hear" was adjacent to "twins" and
the answer was pare rather than pair. The indicator could come
between the words if the y were of different lengths and the
enumeration was given, such as in the case of "right" and
"rite".

Deletions

Deletions consist of beheadments, curtailments, and internal


d e l e t i o n s . I n b e h e a d m e n t s , a w o r d l o s e s i t s f i r s t l e t t e r. I n
c u r t a i l m e n t s , i t l o s e s i t s l a s t l e t t e r, a n d i n t e r n a l d e l e t i o n s
r e m o v e a n i n n e r l e t t e r, s u c h a s t h e m i d d l e o n e .

An example of a beheadment:

Beheaded celebrity is sailor (3)

T h e a n s w e r w o u l d b e TA R , a n o t h e r w o r d f o r " s a i l o r " , w h i c h i s a
" c e l e b r i t y" , o r s t a r, w i t h o u t t h e f i r s t l e t t e r.

Other indicator words of beheadment include "don't start",


"topless", and "after the first".

An example of curtailment:

Shout, "Read!" endlessly (3)

The answer is BOO. If you ignore the punctuation, a book is a


" r e a d " , a n d b o o k " e n d l e s s l y" i s b o o , a " s h o u t " .

Other indicators include "nearly" and "unfinished".

An example of internal deletion:

24
Challenging sweetheart heartlessly (6)

The answer is DARING, which means "challenging", and is


d a r l i n g w i t h o u t i t s m i d d l e l e t t e r, o r " h e a r t l e s s l y" .

Combination clues

A c l u e m a y e m p l o y m o r e t h a n o n e m e t h o d o f w o r d p l a y. F o r
example:

Illustrious baron returns in pit (9)

The answer is HONORABLE. "Baron" "returns", or is reversed,


and put inside "pit" or hole, to make honorable, or "illustrious".

"& lit."

A r a r e c l u e t yp e i s t h e "& lit." clue, standing for "and literally


so". In this case, both the wordplay and the definition halves
are the same. In some publications this is alwa ys indicated by
an exclamation point at the end of the clue. For example:

God incarnate, essentially! (4)

The answer is ODIN. The Norse god Odin is hidden in "god


i n c a r n a t e , " a s c l u e d b y " e s s e n t i a l l y, " b u t t h e d e f i n i t i o n o f O d i n
is also the whole clue, as Odin is essentially a God incarnate.

This satisfies the "& lit." clue definition, but as read is clearly a
cr yp tic clue. Another e xam ple:

Spoil vote! (4)

would give the answer VETO as a perfectly passable clue in a


c o n c i s e c r o s s w o r d ; i n a c r y p t i c p u z z l e , h o w e v e r, s p o i l w o r k s a s
an anagram indicator for vote, while the whole clue is, with a
certain amount of license allowed to crossword setters, the
definition.

2.4.7 SECURITY AN D ENCRYP TION

T h e a n a g r a m h a s i t s r e a c h t i l l t h e c r y p t o g r a p h y. T h i s i s v e r y
n i c e t o o l f o r t h e e n c r y p t i o n a n d d e c r yp t i o n p u r p o s e . T h e r e m a y

25
b e m a n y w a y s t o e n c r y p t a n d d e c r yp t a d a t a b u t i f t h e p r o g r a m
is intended to be made simpler and less complex in all areas
then the anagram implementation suits.

2 . 4 . 7 . 1 S K Y P E S O F T WAR E

Ever since Skype was launched, we have said it is, and will
r e m a i n , s e c u r e . Yo u r S k y p e - t o - S k yp e c a l l s , c h a t s a n d o t h e r
c o m m u n i c a t i o n s a r e e n d - t o - e n d e n c r yp e d .

What sometimes happens is that after claiming this, we get


a s k e d “ yo u s a y y o u ’ r e s e c u r e … s o p r o v e i t ” . T h a t ’ s a v a l i d
q u e s t i o n — a n yo n e c a n c l a i m a n y t h i n g a b o u t t h e i r o w n p r o d u c t .
We have recognized that you want more assurance than we sa y
ourselves. So we did a comprehensive external security review
of Skype, focusing on its encryption methods.

We’re happy to report that the work is now complete and you
c a n d o w n l o a d t h e f u l l r e p o r t f r o m S k yp e s e c u r i t y c e n t e r ( P G P
signature). There’s also an executive summary available. Note
t h a t w h i l e t h e f u l l r e p o r t w a s c o m p i l e d b y D r. To m B e r s o n f r o m
Anagram Laboratories, the summary is written in-house by
Sk ype based on the full report .

I n s h o r t , t h e c o n c l u s i o n o f t h e r e p o r t i s t h a t S k yp e u s e s
standards-based methods and a sound design to secure its
users, software and system, and does what it says — is secure.
Of course, security is never “done”, so security continues to be
a n i m p o r t a n t t r a c k i n a l l S k yp e d e v e l o p m e n t s a n d o p e r a t i o n s .

W h o a r e To m B e r s o n a n d A n a g r a m a n y w a y ? I n t h e i r o w n w o r d s :

Anagram Laboratories is an information security consultancy


based in Palo Alto, CA. Anagram was founded in 1986, back
b e f o r e i n f o r m a t i o n s e c u r i t y w a s c o o l . D r. T h o m a s A . B e r s o n ,
A n a g r a m ’ s o w n e r, h a s m o r e t h a n 3 5 y e a r s e x p e r i e n c e i n
c r y p t o l o g y a n d c o m p u t e r s e c u r i t y.

To m i s a l o n g - t i m e v e t e r a n i n f o r m a t i o n s e c u r i t y e x p e r t w i d e l y
r e s p e c t e d b y h i s p e e r s i n t h e s e c u r i t y i n d u s t r y. T h i s i s a
standard method of doing this type of research — you don’t just
want to get anyone “off the street” to do it for you because the
name is unknown in the industry and the quality cannot be
trusted. Our selection process for finding the right person and
c o m p a n y t o d o t h e S k yp e s e c u r i t y r e v i e w s t a r t e d m o r e t h a n a

26
year ago, and we’re happy to have ended up working with Dr
Berson.

As Skype and its software and services evolve, so does the


need for security and similar reviews. This won’t remain the
last one, but we’re happy to get our securit y review process off
the ground with this report.

3 M AT E R I AL S AN D M E T H O D S

3 . 1 P L AT F O R M

P e r l i s a d yn a m i c p r o g r a m m i n g l a n g u a g e c r e a t e d b y L a r r y Wa l l
and first released in 1987. Perl borrows features from a variety

27
o f o t h e r l a n g u a g e s i n c l u d i n g C , s h e l l s c r i p t i n g ( s h ) , AW K , s e d
and Lisp.

S t r u c t u r a l l y, P e r l i s b a s e d o n t h e b r a c e - d e l i m i t e d b l o c k s t y l e o f
AW K a n d C , a n d w a s w i d e l y a d o p t e d f o r i t s s t r e n g t h s i n s t r i n g
processing, and lack of the arbitrary limitations of many
scripting languages at the time.

Dynamic programming language is a term used broadl y in


computer science to describe a class of high level programming
languages which share many common runtime behaviors that
other languages might perform during compilation, if at all.
These behaviors could include extension of the program, by
adding new code, or by extending objects and definitions, or by
m o d i f y i n g t h e t yp e s y s t e m , a l l d u r i n g p r o g r a m e x e c u t i o n . T h e s e
behaviors can be emulated in nearly an y language of sufficient
c o m p l e x i t y, b u t d y n a m i c l a n g u a g e s p r o v i d e d i r e c t t o o l s t o m a k e
use of them.

D y n a m i c l a n g u a g e s a n d d yn a m i c t yp i n g a r e n o t i d e n t i c a l
concepts, and a dynamic language need not be dynamically
t yp ed, though man y d ynam ic languages are d ynam icall y t yped.

3.2 OVERVIEW

Perl is a general-purpose programming language originally


developed for text manipulation and now used for a wide range
of tasks including system administration, web development,
network programming, GUI development, and more.

The language is intended to be practical (eas y to use, efficient,


c o m p l e t e ) r a t h e r t h a n b e a u t i f u l ( t i n y, e l e g a n t , m i n i m a l ) . I t s
major features include support for multiple programming
paradigms (procedural, object-oriented, and functional styles),
automatic memory management, built-in support for text
processing, and a large collection of third-party modules.

3 . 3 F E AT U R E S

The overall structure of Perl derives broadly from C. Perl is


procedural in nature, with variables, expressions, assignment
statements, brace-delimited code blocks, control structures,
and subroutines.

28
Perl also takes features from shell programming. All variables
are marked with leading sigils, which unambiguously identify
t h e d a t a t yp e ( s c a l a r, a r r a y, h a s h , e t c . ) o f t h e v a r i a b l e i n
c o n t e x t . I m p o r t a n t l y, s i g i l s a l l o w v a r i a b l e s t o b e i n t e r p o l a t e d
directly into strings. Perl has many built-in functions which
provide tools often used in shell programming (though many of
these tools are implemented by programs external to the shell)
like sorting, and calling on system facilities.

Perl takes lists from Lisp, associative arrays (hashes) from


AW K , a n d r e g u l a r e x p r e s s i o n s f r o m s e d . T h e s e s i m p l i f y a n d
facilitate many parsing, text handling, and data management
tasks.

In Perl 5, features were added that support complex data


structures, first-class functions (i.e. closures as values), and
an object-oriented programming model. These include
references, packages, class-based method dispatch, and
lexically scoped variables, along with compiler directives (for
example, the strict pragma). A major additional feature
introduced with Perl 5 was the ability to package code as
r e u s a b l e m o d u l e s . L a r r y Wa l l l a t e r s t a t e d t h a t " T h e w h o l e i n t e n t
of Perl 5's module system was to encourage the growth of Perl
culture rather than the Perl core."

All versions of Perl do automatic data typing and memory


management. The interpreter knows the type and storage
requirements of every data object in the program; it allocates
a n d f r e e s s t o r a g e f o r t h e m a s n e c e s s a r y. L e g a l t yp e
c o n v e r s i o n s a r e d o n e a u t o m a t i c a l l y a t r u n t i m e ; i l l e g a l t yp e
conversions are fatal errors.

3.4 DESIGN

The design of Perl can be understood as a response to three


broad trends in the computer industry: falling hardware costs,
r i s i n g l a b o r c o s t s , a n d i m p r o v e m e n t s i n c o m p i l e r t e c h n o l o g y.
Many earlier computer languages, such as Fortran and C, were
designed to make efficient use of expensive computer
hardware. In contrast, Perl is designed to make efficient use of
expensive computer programmers.

Perl has many features that ease the programmer's task at the
expense of greater CPU and memory requirements. These
include automatic memor y management; dynamic typing;

29
strings, lists, and hashes; regular expressions; introspection
and an eval() function.

Wa l l w a s t r a i n e d a s a l i n g u i s t , a n d t h e d e s i g n o f P e r l i s v e r y
much informed by linguistic principles. Examples include
Huffman coding (common constructions should be short), good
end-weighting (the important information should come first),
and a large collection of language primitives. Perl favors
language constructs that are natural for humans to read and
w r i t e , e v e n w h e r e t h e y c o m p l i c a t e t h e P e r l i n t e r p r e t e r.

Perl syntax reflects the idea that "things that are different
should look different". For example, scalars, arrays, and
hashes have different leading sigils. Arra y indices and hash
ke ys use different kinds of braces. Strings and regular
expressions have different standard delimiters. This approach
can be contrasted with languages like Lisp, where the same S-
e x p r e s s i o n c o n s t r u c t a n d b a s i c s yn t a x i s u s e d f o r m a n y
different purposes.

Perl does not enforce any particular programming paradigm


(procedural, object-oriented, functional, etc.), or even require
the programmer to choose among them.

There is a broad practical bent to both the Perl language and


the community and culture that surround it. The preface to
Programming Perl begins, "Perl is a language for getting your
job done." One consequence of this is that Perl is not a tidy
language. It includes features if people use them, tolerates
e x c e p t i o n s t o i t s r u l e s , a n d e m p l o ys h e u r i s t i c s t o r e s o l v e
s yn tactical am biguities. Because of the forgi ving nature of the
c o m p i l e r, b u g s c a n b e h a r d t o f i n d s o m e t i m e s . D i s c u s s i n g t h e
variant behaviour of built-in functions in list and scalar
contexts, the perlfunc(1) manual page says "In general, they do
w h a t y o u w a n t , u n l e s s y o u w a n t c o n s i s t e n c y. "

Perl has several mottos that convey aspects of its design and
use. One is "There's more than one way to do it ." (TIMTOW TDI,
u s u a l l y p r o n o u n c e d ' Ti m To a d y ' ) . O t h e r s a r e " P e r l : t h e S w i s s
Army Chainsaw of Programming Languages" and "No
unnecessary limits". A stated design goal of Perl is to make
easy tasks eas y and difficult tasks possible. Perl has also been
c a l l e d " T h e D u c t Ta p e o f t h e I n t e r n e t " .

There is no written specification or standard for the Perl


language, and no plans to create one for the current version of

30
Perl. There has only ever been one implementation of the
i n t e r p r e t e r. T h a t i n t e r p r e t e r, t o g e t h e r w i t h i t s f u n c t i o n a l t e s t s ,
stands as a de facto specification of the language.

3 . 5 A P P L I C AT I O N S

Perl has many and varied applications, compounded by the


availability of many standard and third-party modules.

P e r l h a s b e e n u s e d s i n c e t h e e a r l y d a ys o f t h e W e b t o w r i t e
CGI scripts. It is known as one of "the three Ps" (along with
P y t h o n a n d P H P ) , t h e m o s t p o p u l a r d yn a m i c l a n g u a g e s f o r
writing Web applications (which now also include Ruby). It is
also an integral component of the popular LAMP solution stack
for web development. Large projects written in Perl include
S l a s h , B u g z i l l a , T W i k i a n d M o v a b l e Ty p e . M a n y h i g h - t r a f f i c
websites, such as Amazon.com, Livejournal.com,
Ti c k e t m a s t e r. c o m a n d I M D b . c o m u s e P e r l e x t e n s i v e l y.

P e r l i s o f t e n u s e d a s a g l u e l a n g u a g e , t yi n g t o g e t h e r s ys t e m s
and interfaces that were not specifically designed to
interoperate, and for "data munging", ie. converting or
processing large amounts of data for tasks like creating
reports. In fact, these strengths are intimately linked. The
combination makes perl a popular all-purpose tool for system
administrators, particularly as short programs can be entered
and run on a single command line.

Perl is also widely used in finance and bioinformatics, where it


i s v a l u e d f o r r a p i d a p p l i c a t i o n d e v e l o p m e n t a n d d e p l o ym e n t ,
and the ability to handle large data sets.

3 . 6 I M P L E M E N TAT I O N

P e r l i s i m p l e m e n t e d a s a c o r e i n t e r p r e t e r, w r i t t e n i n C , t o g e t h e r
with a large collection of modules, written in Perl and C. The
source distribution is, as of 2005, 12 MB when packaged in a
tar file and compressed. The interpreter is 150,000 lines of C
c o d e a n d c o m p i l e s t o a 1 M B e x e c u t a b l e o n t yp i c a l m a c h i n e
a r c h i t e c t u r e s . A l t e r n a t i v e l y, t h e i n t e r p r e t e r c a n b e c o m p i l e d t o
a link library and embedded in other programs. There are
nearly 500 modules in the distribution, comprising 200,000

31
lines of Perl and an additional 350,000 lines of C code. (Much
of the C code in the modules consists of character encoding
tables.)

The interpreter has an object-oriented architecture. All of the


elements of the Perl language—scalars, arrays, hashes,
coderefs, file handles—are represented in the interpreter by C
structs. Operations on these structs are defined by a large
collection of macros, typedefs and functions; these constitute
the Perl C API. The Perl API can be bewildering to the
uninitiated, but its entry points follow a consistent naming
scheme, which provides guidance to those who use it.

The execution of a Perl program divides broadly into two


phases: compile-time and run-time.[9] At compile time, the
interpreter parses the program text into a syntax tree. At run
time, it executes the program by walking the tree. The text is
parsed only once, and the syntax tree is subject to optimization
before it is executed, so the execution phase is relatively
e f f i c i e n t . C o m p i l e - t i m e o p t i m i z a t i o n s o n t h e s yn t a x t r e e i n c l u d e
constant folding and context propagation, but peephole
o p t i m i z a t i o n i s a l s o p e r f o r m e d . H o w e v e r, c o m p i l e - t i m e a n d r u n -
time phases may nest: BEGIN code blocks execute at compile-
time, while the eval function initiates compilation during
runtime. Both operations are an implicit part of a number of
o t h e r s — m o s t n o t a b l y, t h e u s e c l a u s e t h a t l o a d s l i b r a r i e s , k n o w n
in Perl as modules, implies a BEGIN block.

Perl has a context-sensitive grammar which can be affected by


code executed during an intermittent run-time phase.[10]
T h e r e f o r e P e r l c a n n o t b e p a r s e d b y a s t r a i g h t L e x / Ya c c
lexer/parser combination. Instead, the interpreter implements
i t s o w n l e x e r, w h i c h c o o r d i n a t e s w i t h a m o d i f i e d G N U b i s o n
parser to resolve ambiguities in the language. It is said that
"only perl can parse Perl", meaning that only the Perl
interpreter (perl) can parse the Perl language (Perl). The truth
of this is attested to by the persistent imperfections of other
programs that undertake to parse Perl, such as source code
anal yzers and auto-indenters, which ha ve to contend not onl y
with the many ways to express unambiguous syntactic
constructs, but also the fact that Perl cannot be parsed in the
general case without executing it.

Perl is distributed with some 120,000 functional tests. These


run as part of the normal build process, and extensively
exercise the interpreter and its core modules. Perl developers

32
rely on the functional tests to ensure that changes to the
i n t e r p r e t e r d o n o t i n t r o d u c e b u g s ; c o n v e r s e l y, P e r l u s e r s w h o
see the interpreter pass its functional tests on their system can
h a v e a h i g h d e g r e e o f c o n f i d e n c e t h a t i t i s w o r k i n g p r o p e r l y.

Maintenance of the Perl interpreter has become increasingly


difficult over the years. The code base has been in continuous
development since 1994. The code has been optimized for
p e r f o r m a n c e a t t h e e x p e n s e o f s i m p l i c i t y, c l a r i t y, a n d s t r o n g
internal interfaces. New features have been added, yet virtuall y
complete backward compatibility with earlier versions is
maintained. The size and complexity of the interpreter is a
barrier to developers who wish to work on it.

3.7 DISCUSSIONS

3 . 7 . 1 A R E T H E R E A N Y U N U S U AL VAR I E T I E S O F A N AG R AM S ?

( A d a p t e d f r o m W o r d s a t P l a y b y O . V. M i c h a e l s e n , a n d w i t h
a d d i t i o n a l m a t e r i a l f r o m W i l l i a m Tu n s t a l l - P e d o e )

A n a n t i g r a m , o r a n t o n ym o u s a n a g r a m , h a s a n o p p o s i t e m e a n i n g
to the subject text. Such anagrams are quite uncommon and
often accidentally discovered. Here are some great examples:

• Funeral = real fun!


• Antagonist = not against.
• Evangelists = evil's agents.
• T h e O s c a r N o m i n a t i o n s = I t ' s n o t a c i n e m a h o n o r.
• Protectionism = nice to imports.
• Saintliness = entails sins.
• Sweltering heat = the winter gales
• Within earshot = I won't hear this.
• On a slightly more taboo subject, Mick Tu l l y ' s
Unite Against Fascism -- Antisemitic fun's a gas.

A word that is spelled backward to become a new word, a word


reversal, has been called an anadrome. This term combines
'ana-' from anagram and '-drome' from palindrome. Lewis
Carroll called this a semordnilap ('palindromes' spelled
b a c k w a r d s ) . O l d e r s o u r c e s ( D u d e n e y, 1 9 2 9 ) r e f e r r e d t o t h e s e
as antigrams. Examples of this genre include:

33
• Evian = naive.
• Pat = tap.
• Samaroid = dioramas.

Tr a n s p o s e d c o u p l e t s , o r p a i r a g r a m s , a r e s i n g l e - w o r d a n a g r a m s
that placed together create a short meaningful phrase.

• A c t o r s c o - s t a r.
• Best bets.
• Demo mode.
• Elvis lives.
• Float aloft.
• Latent talent.
• American Cinerama.
• L o v e l y v o l l e y.
• Nameless salesmen.
• Oriental relation.
• Outer route.
• Streaming emigrants.

3 . 7 . 2 W H AT I S T H E L O N G E S T O N E - W O R D A N AG R AM ?

Which is the longest anagram of a single word into another


single word depends on the amount of transposition of letters
that is acceptable and also whether using rather contrived
technical, scientific, or medical names is acceptable.

According to the Guinness Book of Records, the longest non-


scientific English words that form anagrams are the 18-letter
o n e s b e l o w ; h o w e v e r, t h e y r e q u i r e n o m o r e t h a n a s i m p l e s w a p
of two letters.

• conversationalists = conservationalists

The longest scientific anagram is 27 letters, but this involves


j u s t t h e s i m p l e m o v e m e n t o f o n e l e t t e r.

• Hydroxydeoxycorticosterones =
Hydroxydesoxycorticosterone.

Our list of 12- to 17-letter words that can be anagrammed into


a n o t h e r w o r d w a s c o m p i l e d b y W i l l i a m Tu n s t a l l - P e d o e a n d L a r r y
Brash. Being on the list requires that no more than three
consecutive letters from the original be repeated in sequence in
the anagram, but the list does include unusual or technical
words.

34
3 . 7 . 3 W H AT S E T O F L E T T E R S H AS T H E M O S T O N E - W O R D
A N AG R AM S ?

One problem in answering this question is that there is no one


authority as to what constitutes a legitimate word. Ross
Eckler's Making the Alphabet Dance lists 24 anagrams of the
letters 'aest', but many of these are quite obscure and they are
drawn from a wide range of sources.

Merriam-Webster's unabridged dictionary contains entries for


these 14 words:

• a n e s t r i , a s t e r i n , e r a n i s t , n a s t i e r, r a t i n e s , r e s i a n t , r e s t a i n ,
r e t a i n s , r e t i n a s , r e t s i n a , s a i n t e r, s t a i n e r, s t a r n i e , s t e a r i n

Other wordplay sources omit some of these words and/or add


others, including the multi-word anagrams 'tin ears' and 'in
tears'.

W o r d Wa y s h a s f o r s o m e y e a r s b e e n c o l l e c t i n g a n a g r a m s o f
' a e g i n r s t ' . W i l l i a m Tu n s t a l l - P e d o e i n d i c a t e s t h a t a w h o p p i n g
157 of these have some justification.

3 . 7 . 4 W H AT I S T H E P O I N T O F AN A G R AM S ?

E s s e n t i a l l y, a n a g r a m m i n g i s a r e c r e a t i o n a l a c t i v i t y. G r e a t
pleasure can be obtained when one finds a witty anagram in
someone's name. We will often find the 'hidden truth' in an
anagram of a person's name:

• M a t t h i a s N . R i t c h i e . = I a m t h e A n t i c h r i s t ! ( M i c k Tu l l y,
1998)

A 'visitor' to alt.anagrams presented the above false name for


anagramming. Practical joking is not unknown in alt.anagrams .

An important aim is to find a relevant or apt anagram that is


amusing, poignant, or abusive in content, and one that either
paraphrases the original text or creates an 'antigram', an
anagram with the opposite meaning to the subject text.

Occasionally anagram puzzles are presented to be solved, e.g.,


a b o o k t i t l e a n d a u t h o r. I t i s a g r e a t f e e l i n g w h e n y o u c r a c k t h e
code.

35
To p i c a l a n a g r a m s f r o m c u r r e n t e v e n t s a r e f r e q u e n t l y a s o u r c e
of interest. For example:

• B o s n i a n Wa r C r i m e s . = S e r b i a n r a c i s m w o n . ( To m M y e r s ,
1999)
• Whitehouse Intern Miss Monica Samille Lewinsky = Hey!
William Clinton arouses me. Hi! I'm Ken's witness!
( W i l l i a m Tu n s t a l l - P e d o e , 1 9 9 8 )

Occasionally this newsgroup is belittled by outsiders who think


that it is all a waste of time and that we 'are stupid geeks and
s h o u l d g e t a l i f e ' . S u c h c r i t i c i s m i s d e a l t w i t h i n o u r u s u a l w a y.
We anagram the crap out of the critic!

3 . 7 . 5 H O W D O Y O U C R E AT E A N AG R AM S ?

There are two basic wa ys: Manually or with an anagram


generator program.

The main advantages of using a computer program are speed


a n d t h e g e n e r a t o r ' s d i c t i o n a r y. T h e y w i l l g e n e r a t e h u n d r e d s o r
thousands of anagrams in a minute or two. Most will be
meaningless, and one has to wade through them, find the most
appropriate combinations of words, arrange the words, etc.

There has been debate in the group as to whether using an


anagram generator is 'cheating'. Sometimes, generators will
quickl y reveal a great anagram, but there is always a modicum
of luck and a lot of skill needed to find the best anagrams. The
consensus here is that it is not cheating. Programs have also
been written that juggle items in a long list (recording artists,
aphorisms, etc.) between the 'left' and 'right' side until an
anagram is formed; while opinions vary as to the artistry and
m e r i t o f a n a g r a m s g e n e r a t e d i n t h i s w a y, t h e r e i s r o o m i n t h e
group for such anagrams and civil discussion of them.

3 . 7 . 6 W H AT AR E T H E H AL L M AR K S O F A G O O D AN AG R AM ?

These are hallmarks of a good anagram, mostly as gleaned


from erudite postings on this subject by Richard Brodie, William
Tu n s t a l l - P e d o e , Richard Grantham, and Jean Fontaine.
Examples from the folk in alt.anagrams are included.

(1) Meaningfulness. It must be more than just a series of


u n c o n n e c t e d w o r d s i n n o p a r t i c u l a r o r d e r. I t m u s t ' s o u n d ' l i k e a
meaningful phrase or a sentence, however condensed.

36
Condensations that sound like newspaper headlines are quite
acceptable. Simply reordering the words can make a difference.

• Male chauvinism =
Va l i u m m a c h i n e s - - i s q u i t e b i z a r r e a n d m e a n i n g l e s s .
Ah, masculine vim -- is a bit b e t t e r.
I ' m s u c h a v i l e m a n . ( J a yb u r, 2 0 0 0 ) - - m a k e s g r e a t s e n s e .

(2) Aptness, relevance, or reference to the original phrase. This


m a y i n v o l v e t h e u s e o f s yn o n ym s , p a r a p h r a s i n g t h e o r i g i n a l
phrase, or a commentary or joke about the original. The more
relevant the anagram is to the original phrase, the better it will
be regarded. It may even be the direct opposite in meaning (an
antigram). Examples might also include a question in the
original phrase that is answered in the anagram.

• Madonna Louise Ciccone =


Anomalous coincidence -- not very apt.
Musical? Done cocaine? No! -- is getting more relevant.
One cool dance musician. (David Bourke, 2000) -- this one
is very relevant.

( 3 ) E x p l a n a t i o n . A n a n a g r a m s h o u l d b e s e l f - e x p l a n a t o r y, s e l f -
sufficient; it should not need an y extra explanation or comment.
O c c a s i o n a l l y, such as when the subject matter is
obscure/regional or the anagram refers to a little-known aspect
of the original, it may validly be accompanied by some brief
d e t a i l s ; h o w e v e r, i n m o s t c a s e s , t h e a n a g r a m i s w e a k i f a n
explanation is required.

• Ta m - o ' - s h a n t e r =
One smart hat. (Janet Muggeridge, 1999)

(4) Avoidance of incorrect or uncommon spellings. These


detract from the quality of the anagram and make it seem
contrived or the author seem semi-literate. Old-fashioned
s p e l l i n g s ( h a t h , d o t h , a ye , n a y, ' t i s ) a r e o f t e n a c c e p t a b l e . S o
t o o a r e s h o r t e n e d w o r d s l i k e ' n ' ( f o r ' a n d ' ) , e ' e r, o r m a ' a m ,
p a r t i c u l a r l y i f a p p r o p r i a t e t o t h e s t yl e o f t h e a n a g r a m .

• Gastroenterologist =
I let go torrents o' gas. -- the use of the shortened form of
'of' is a minor f l a w.
(Larry Brash, 2000)

37
(5) Avoidance of repetition of words in original phrase.
Repeating a key word from the original in its anagram detracts
from the cleverness of the result. The repetition of 'the' and
o t h e r s h o r t n o n - k e y w o r d s i s q u i t e O K , o f c o u r s e . O c c a s i o n a l l y,
the repetition is acceptable. Such an anagram is sometimes
referred to as a parallelogram.

• These girls are barely legal =


The "girls" are really beagles. -- repetition is used for a
funny effect.
(Richard Grantham, 2000)

( 6 ) H u m o u r, b e i t r u d e , w i t t y, s a r c a s t i c , o r a b u s i v e , w i l l a l w a y s
improve an anagram, especially when the punchline contains a
real surprise. WARNING: Eating and drinking whilst reading
alt.anagrams can lead to the contents of your oral cavity being
sprayed over your monitor or drinks being spilt onto your
ke yboard.

• Inflammatory Bowel Disease =


M y a s s b l e w f i r e , I m o a n e d a l o t . - - i s v e r y f u n n y, y o u
would have to admit.
(Meyran Kraus, 2000)

(7) Grammatical correctness is the one area where some of us


are pedantic. Many a good anagram has failed because of poor
g r a m m a r. F o r e x a m p l e , n o u n s s t a r t i n g w i t h a v o w e l s o u n d m u s t
have 'an' rather than 'a' before them. Minor discrepancies can
be overlooked if the anagram excels in all other areas. Long
anagrams should have impeccable grammar because having so
many letters allows great flexibility in construction.

• Wile E. C o yo t e and The Roadrunner =


Tr y a c a r t o o n d u e l w h e r e n o n e d i e ! - - g o o d g r a m m a r
despite a short subject.
(Meyran Kraus, 2000)

(8) Clever use of punctuation. The use of punctuation has its


critics, the purists who disapprove of any punctuation at all.
H o w e v e r, g o o d u s e o f p u n c t u a t i o n c a n i m p r o v e a n o r d i n a r y
anagram and change it into an extraordinary one, if cleverly
done.

• The Immaculate Conception =


Pathetic cult... I mean, come ON!
(Meyran Kraus, 2006)

38
Perhaps the ultimate in flow allowed through punctuation is an
anagram with the phrase in the left side continuing on in the
right-hand side, for one coherent thought. These are usually
more impressive if one or the other side is a set phrase. An
example:

• Races can ruin ~ car insurance! (Joe Fathallah, 2002)

(9) Minimal use of interjections. Whilst the use of 'oh', 'eh',


'hey', 'ah', 'ahem', 'shhh', and so on can be a hand y wa y of
g e t t i n g r i d o f t h o s e a n n o yi n g l e f t - o v e r l e t t e r s , m a n y b e l i e v e t h a t
the excessive use of this device will damage an anagram. The
use of one interjection in an otherwise great anagram is often
considered acceptable. The key is for the word to be well-
integrated rather than tacked on. Even the much-maligned 'hi'
can sometimes enhance an anagram.

• The German neurologist Dr Alois Alzheimer =


M e m o r i e s g o i n g , l o s t i n a r a t h e r d u l l . . . e r. . . h a z e . - - H e r e ,
the 'er' looks like it belongs and is not merely a way to get
rid of two 'extra' letters. It is in keeping with the topic and
adds a bit of h u m o u r.
(David Bourke, 2004)

(10) Avoidance of contrived subject text. The best anagrams


are those where the subject text is a familiar phrase or a real
name. Using highly contrived subject text to create a clever
anagram considerably weakens the result. Using minor
contrivances, such as adding the definite or indefinite article to
t h e t e x t , i s a m u c h l e s s s e r i o u s f l a w.

• A McDonald's burger =
Real dog and crumbs. -- adding an 'A' to the subject made
this one work.
( M i c k Tu l l y, 1 9 9 8 )

( 11 ) W e l l - k n o w n s u b j e c t t e x t . T h e m o r e f a m o u s t h e n a m e o f t h e
person or thing being anagrammed, the better the result is
likely to be.

• Leonardo DiCaprio = Ocean idol, or a drip? -- Nearly


everyone has heard of him!
(David Bourke, 2000)

39
(12) Selectness. An anagram should represent your best efforts
with the given letters. Don't make hundreds of readers sift
through your efforts to find the good ones (or quit in disgust):
do the selection yourself, though you may solicit readers'
opinions on which of a couple wording options works best.
Remember: if you've done twenty anagrams on the same base
phrase, at least ten of them are crap. No, don't tell us how you
were experimenting with different approaches, and don't add
comments to explain their glories. At least ten of them are crap.

3.7.7 SKE TCH OF ALGORITHM

Assume that the dictionary is read from a file where

dictionary = ["opt", "pans", "pots", "snap", "stop", "tops"]

In order to find the anagrams of a word we first create what we


will call an ‘anagram dictionary’. We observe that all words that
are anagrams of each other have the same ‘base’ form. The
base form of a word is the sorted version of the word, e.g. the
base form of “rat” is “art”. An anagram dictionary is an array or
table of lists indexed by the base form of the words in the list,
i.e. the table is indexed by a base form and the value at an
index is the list of words in the input dictionary that are
anagrams of this base form.

e . g . To f i n d t h e a n a g r a m s o f a w o r d w e f i r s t r e d u c e i t t o b a s e
form and then we search the

anagram dictionary for this base form. For example, to find the
anagrams of “snap” we reduce it to its base form “anps” and
search the anagram dictionary for “anps” and return the value
at this index, the words “pans” and “snap”. The input word itself
m a y n o t b e i n t h e g i v e n d i c t i o n a r y, w h a t t h e p r o g r a m f i n d s i s a l l
t h e w o r d s t h a t a r e a n a g r a m s o f i t i n t h e g i v e n d i c t i o n a r y.

3 . 7 . 8 M ET H O D S ( C O N T D . . . )

Before the Computer Age, anagrams were constructed using a


p e n a n d p a p e r o r l e t t e r e d t i l e s , b y p l a yi n g w i t h l e t t e r
combinations and experimenting with variations. (Some
individuals with prodigious talent have also been known to ‘see’
anagrams in words, unaided by tools.) Anagram dictionaries
could also be used to create anagrams.

40
Computers have enabled a new method of creating anagrams,
the anagram ser ver, anagram sol ve r or anagrammer. These
are often used to find solutions for crosswords, Scrabble,
Boggle and other word games. A large number of these are
available on the Internet. When the anagrammist enters a word
or phrase the program or server utilizes an exhaustive
database of words to produce a list containing every possible
combination of words or phrases from the input word or phrase.
Some programs such as Lexpert (used for Scrabble) only allow
one-word answers. Many anagram servers can control the
search results, by excluding or including certain words, limiting
the number or length of words in each anagram, or limiting the
number of results. Anagram solvers are often banned from
o n l i n e a n a g r a m g a m e s , s u c h a s Ya h o o ! L i t e r a t i w h e r e t h e y c a n
be used for an unfair advantage, in some cases allowing a
pla ye r to ne ver miss a single word .

Anagram solvers do not have to use English. Any language can


be used, particularly those which use the Roman alphabet.
Anagrammers can even find solutions in multiple languages at
the same time. Anagrammers may have other related functions,
such as fitting the letters into a certain sequence. If while
doing a crossword the reader knows he has a seven letter word
in the form Z?R??N? (the question marks represent a blank
square) then an anagram solver can tell us all the words that fit
t h i s p a t t e r n , f o r e x a m p l e z e r o i n g a n d zi r c o n s .

When sharing their newly discovered anagrams with other


enthusiasts, some anagrammists indicate the method they
used. Anagrams constructed without aid of a computer are
noted as having been done ‘manually’ or ‘by hand’; those made
by utilizing a computer may be noted ‘by machine’ or ‘by
computer ’, or may indicate the name of the computer program
(using ‘Anagram Genius’).

41
4 R E S ULT S

The input is fed to the program and the output generation is


done by checking the anagram for the given input and if present
it feeds it back or else there is no anagram possible for the
given input.

4 . 1 P R O G R AM R U N :

Earth

Anagram generated:

Heart

42
Abroad

Anagram generated:

Aboard

Raw

Anagram generated:

Wa r

Acme

Anagram generated:

Came

Mace

Aligned

Anagram generated:

Leading

Dealing

4 . 2 P E R F O R M AN C E AN ALY S I S

4.2.1 A SLOW ALGOR ITHM

E x a m i n e A l l P e r m u t a t i o n s . ‘ ‘ c h o l e c y s t o d u o d e n o s t o m y’ ’
h a s 2 2 ! p e r m u t a t i o n s . O n e p i c o s e c o n d e a c h g i v e s 1 . 11 0 9
seconds, or a few
d e c a d e s . ( T h e r u l e o f t h u m b t h a t ‘ ‘  s e c o n d s i s a n a n o c e n t u r y’ ’
is half a percent off the true value of 3. 155107 seconds per
y e a r. )
Examine All Pairs of Words. Assume 230,000

43
words in the dictionary

S TAT I S T I C S :

1 microsecond per compare.


230, 000 words, 230, 000 comps/word 1 microsecond/comp
52900106 microseconds
52900 seconds
14.7 hours

4 . 2 . 2 A FAS T A L G O R I T H M

The Idea. Sign words so that those in the same anagram class
have the same signature, and then collect equal signatures.
The Signature. Sort letters within a word. The signature of
‘‘deposit’’ is ‘‘deiopst’’, which is also the
signature of ‘‘dopiest’’. Collecting the Classes. Sort the words
by their signatures.
A S u m m a r y. S o r t t h i s w a y ( w i t h a h o r i z o n t a l w a v e o f t h e h a n d )
then that way (a vertical wave).

4 . 3 P L AT F O R M U S AG E :

Many questions arise on the basis of why this anagram


implementation has been done in perl and not in some other
language.

The answer to it is explained with reasoning as follows:

As implemented in c/c++:

The coding requires:

44
1. permutation.c
2. stack.h
3. data.h
4. d i c t i o n a r y. c
5. fuse.c

its overview is presented down below:

4 . 3 . 1 P E R M U TAT I O N . C

this consists of the coding which is performed using recursive


backtracking of the given input .Its the main module in the
anagram implementation because in this module we include

stack.h

data.h

here we traverse through all the possible words which can be


formed with the given input. It results in giving an output which
consists of all the possible permutations of the input and this is
what is presented to the user

4 . 3 . 2 D I C T I O N AR Y. C

As the word suggests, this is the module which takes care of


the traversal of the whole dictionary which is nothing but a file
f u l l o f t h e a l l t h e p o s s i b l e t e x t a c c u m u l a t e d b y t h e p r o g r a m m e r.

Here we make the general usage of

Linked list concept and files concept

This serves the purpose of searching a word and letting the


user know whether the word which is being searched for is
p r e s e n t i n t h e d i c t i o n a r y.

4.3.3 FUSE.C

This is the final module which results in the fusing of the above
two module explained. This takes in the output of the
p e r m u t a t i o n . c a n d g i v e s i t a s a n i n p u t t o t h e d i c t i o n a r y. c a n d
after checking the dictionary for each and every permuted word.
The result is show to the user whether the word is present of

45
not. If the word is present then anagram found or else not
found.

4 . 3 . 4 R E S U LTAN T:

1. very lengthy program.


2. Usage of a lot of concept.
3. lot of modular division
4. Fault finding becomes difficult
5. Increase in lines of code
6. Implements slow algorithm(searching each permuted
w o r d i n d i c t i o n a r y)

5 S U M M ARY

The above project can be summarized with the points as


follows:

A N AG R AM

An anagram is a rearrangement of the letters of one


word or phrase to form another word or phrase.

AIM

46
Generation of an anagram by the user for the specified word,
which is presented as an input to the program.

SCOPE

3.1 Astronomy
3.2 P s e u d o n ym s
3.3 Anagrammatic Poem
3.4 Dictionaries
3.5 Scrabble game and puzzles
3.6 Security reasons

P L AT F O R M

ACTIVEPERL

Reason behind this particular language:


As logically implied in the explanation that the c/c++ languages
which are conventionally good and considerable easy to
understand are really difficult to be made use of and
implemented for the purpose of anagram generation.

CONCLUSIONS

1. Permutation of the given input

2. Dictionary file implementation

3. For the given input the output has been successfully


generated and shown as an anagram. Hence fulfilling
the requirements of generating a anagram

47
6 B I L B I O G R AP H Y / R E F E R E N C E S

Where can one find anagram generators, books, and Web sites?

1. Where can I find an anagram generator?

Several programs are available, and more are being written all
the time to meet specific needs. Many of our regular
contributors have developed or are developing anagram
generators and checkers themselves. This is only a partial list
of the programs available:

48
* One of the most popular is Anagram Genius, a commercial
Mac/Windows package. Information and a categorised archive
of anagrams discovered with Anagram Genius is available at
h t t p : / / w w w. a n a g r a m g e n i u s . c o m / .

• Another major player is Anagram Artist,


h t t p : / / w w w. a n a g r a m m y. c o m / r e s o u r c e s / a n a g r a m _ a r t i s t . h t m l
freeware for Windows 98 and XP that is designed more with
longer anagrams in mind.

* A relative newcomer is the cross-platform


(Windows/Linux/UNIX) Nanagram, available at
h t t p : / / w w w. v o i d s p a c e . o r g . u k / a t l a n t i b o t s / n a n a g r a m . h t m l .

* Mac users can try on the shareware Anagrams program for


size. It can be found at
h t t p : / / w w w. t r e v o r r o w. c o m / a n a g r a m s / .
• John Dagg's freeware program Anagen is simple and fast.
Visit
h t t p : / / w w w. g e o c i t i e s . c o m / a s c i w o r x / i n d e x . h t m l
The program works under Win95 and more recent versions of
Windows.

* an is a very fast multi-platform anagram generator (for Linux,


UNIX, Windows, and DOS). The source code and package are
available at http://fatphil.org/words/an.html.

* Anagram Ferret is a freeware program for Windows which


comes as a single file that is used with supplemental
dictionaries. It is available at
http://website.lineone.net/~6hoopers/.

* Another program for Windows, Word Wizard is a commercial


anagram generator with an information page at
h t t p : / / w w w. l a p l a c e . d e m o n . c o . u k / c o d a s o f t / i n d e x . h t m l .

*wscr (Linux/UNIX) is available at


h t t p : / / w w w. g t o a l . c o m / w o r d g a m e s / w s c r / . It comes with source
code.

* Shareware for UNIX and DOS, the venerable Wordplay forms


the backbone for many of the online anagram generators.
Details are at
http://hsvmovies.com/static_subpages/personal/wordplay/.

49
* Manarags 2 (for DOS/Windows, written in 32-bit C++) is
available from To m 7's download page at
h t t p : / / w w w. a n d r e w. c m u . e d u / ~ t w m / m a n a / .

* A l s o , a t h t t p : / / w w w. g t o a l . c o m / w o r d g a m e s / a n a g r a m s . h t m l y o u
will find - if the site is having a good day - a list with links to
various other anagram generators' source code, available from
the gtoal.com site.

Several of these programs support languages other than


English, often through the use of supplemental dictionaries (as
is the case with an). In addition, it is worth noting that:

* Ulf Lunde has created a version of Wordplay which can be


used to produce anagrams in Norwegian. One can email him at
U l f . L u n d e @ k v a t r o . n o t o r e q u e s t a c o p y.

* For anagrams in Dutch there is Maanrag, DOS/W indows


freeware available for download at
h t t p : / / w w w. x s 4 a l l . n l / ~ o n n o z / m a a n r a g / d o w n l o a d . h t m l .

* Anagram Generator includes dictionary files for anagram


generation in Japanese, Italian, French, German, Spanish, and
English. A trial version of this commercial program for Windows
9x/NT/2000 is available at
h t t p : / / w w w. s o f t o l o g y. c o m . a u / a n a g r a m . h t m .

Also, various anagram aids exist. One is the Mar yana pattern-
a n c h o r e d a n a g r a m m e r, d e s c r i b i n g i t s e l f a s " e x t r e m e l y u s e f u l f o r
cheating at Scrabble". It is available for download at
h t t p : / / r u n s l i n u x . n e t / p r o j e c t s / m a r g a n a / m a r g a n a - 1 . 1 . t a r. g z . In
addition, several people have written anagram checker
programs that determine the difference in letters of the subject
text and the anagram-in-progress, letting you know how many
of each letter are still available for use. Information on some
anagram checkers, as well as further details on many of the
anagram generators mentioned above, can be found at
h t t p : / / w w w. a n a g r a m m y. c o m / r e s o u r c e s / g e n e r a t o r s . h t m l .
2. Can you point me to an online anagram generator?

There are many of these. See the list at


h t t p : / / w w w. a n a g r a m m y. c o m / r e s o u r c e s / o n l i n e . h t m l . H o w e v e r, i f
you plan to be doing a lot of anagramming, you might want to
use anagramming software on your own computer rather than

50
increase the load on these sites. Some anagram generation
sites have been closed down or become unusable due to high
traffic.
3. What are the best books on anagrams?

A 'top 6' list is at


h t t p : / / w w w. a n a g r a m m y. c o m / r e s o u r c e s / b o o k s . h t m l .
4. What are some good anagramming-related Web sites?

To m M y e r s h a s a J a v a a p p l e t t h a t c r e a t e s a n i m a t e d a n a g r a m s
a v a i l a b l e a t h i s s i t e h t t p : / / w w w. a n i - g r a m . c o m / .

The Anagrammy site has a page with links to several pages,


most of which were created by alt.anagrams members:
h t t p : / / w w w. a n a g r a m m y. c o m / r e s o u r c e s / w e b s i t e s . h t m l .

51

You might also like