open DICTE, "dict.txt"; if (length($input)>0){ print "
".$input."
"; while ($english - $lang, $clss
";} #if the input equals the word in the dictionary, print it along with its translation. } ####
open DICTE, "dict.txt";
if (length($input)>0){
print "".$input."
";
while (){
chomp;
($english, $lang, $irreg, $clss) = split(/;/,$_); #gets the grammatical informations stored in one line of the dictionary.
if ($input eq $lang){ print "$english - $lang, $clss
";} #if the input equals the word in the dictionary, print it along with its translation.
if (conj("$lang;present;1;singular") eq $lang){ print "$english - $lang, $clss
";} #if the input equals a conjugated form, print it,
if (conj("$lang;present;2;singular") eq $lang){ print "$english - $lang, $clss
";} #where conj("$word;$tense;$person;$number") is a function that conjugates the verb, given the specific informations.
# ... and in every tense, person and number.
}