#!/usr/local/bin/perl
###################################################################
# match.pl - Checks regular expresions against a dictionary file
#
# Jason Friedman (jason@wisdom.weizmann.ac.il)
# March 14, 2000.
#
# eg. To match ?ear, type in: ^.ear$
#     To match st?r?o, type in: ^st.r.o$
# (ie normal regular expressions)
# 
# enter to quit
####################################################################

$currentdir = "/home/albi/public_html/cryptanalysis/";

open(DICT, "$currentdir/smalldic") or die "Can't open dictionary file $!\n";
@words = <DICT>;
close(DICT);

while(true) {
print "Enter a pattern to match: ";
$pattern = <STDIN>;

	if ($pattern =~ /^$/) { last; }
	else { print grep(/$pattern/,@words); }
	
	} 
