The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Word::Anagram - Perl extension for find anagrams of a word

SYNOPSIS

  use Word::Anagram;
  my $obj = Word::Anagram->new;

DESCRIPTION

A class to search anagrams of a word in different contexts. E.g. find the anagrams of a word inside a list of words (dictionary). Or find if two words are anagrams. Or, to filter all anagrams inside a list of words that are anagrams of each other.

Be aware that inside is used a recursive sub and this require a lot of memory during the increase of the word's lenght, while are find all anagrams of a given word.

All search are case-insensitive.

METHODS

are_anagram()
        # check if two words, $word1 $word2, are anagram
        my $obj = Word::Anagram->new;
        my ($word1, $word2) = qw( donna danno );
        my $bool = $obj->are_anagrams($word1, $word2); # return true/false
        
select_anagrams()
        # select all words inside @words that are anagrams
        my $obj = Word::Anagram->new;
        my @words = qw(Donna  Danno Pluto Toplu Paperino Minni);
        my $anag = $obj->select_anagrams(\@words); # return an array ref
        
get_anagrams_of()
        # find all anagrams of $word
        my $obj = Word::Anagram->new;
        my $word = 'ABC';
        my $anag = $obj->get_anagrams_of($word); # return an array ref
find_word_in()
        # find all anagrams of $word inside @words
        my $obj = Word::Anagram->new;
        my $word = 'nonda';
        my @words = qw(donna  danno pluto toplu paperino minni des nodan );
        my $anag = $obj->find_word_in($word, \@words); # return an array ref

AUTHOR

Leo Manfredi, <manfredi@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Leo Manfredi

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.0 or, at your option, any later version of Perl 5 you may have available.