Text::Pangram - utilities to find English pangrams


Version 0.01


use Text::Pangram;

my $text = "The quick brown fox jumps over the lazy dog."; my $pangram = Text::Pangram->new( $text );

print "Pangram!\n" if $pangram->is_pangram;

if ($pangram->find_pangram_window) { print "Smallest window is " . $pangram->window_length " characters:\n"; print $pangram->window . "\n"; } else { print "Not a pangram!\n"; }


A pangram is a text that contains every letter of the alphabet. This module provides utilities for identifying pangrams.


Constructor. Receives the text that will be analyzed.


Returns true if the supplied text is a pangram.


Finds the shortest "pangrammatic window" in a text: the shortest span of text that contains a pangram. It is designed to be fast when scanning large texts.

The method will return false if the text does not contain a pangram at all. If the text is pangrammatic, $pangram will allow you to access three pieces of data:


The length of the shortest pangrammatic window.


The pangrammatic window from the original text.


The stripped text of the pangrammatic window. (That is, with all nonalphabetic characters stripped out.)


Jesse Sheidlower <>


Please report any bugs or feature requests to bug-text-pangram at , or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


Extend to handle non-English text, other alphabets, etc.


Thanks to Adam Turoff, Ben Rosengart, and Perrin Harkins for help and suggestions.


Copyright (c) 2014 Jesse Sheidlower.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.