vendredi 26 décembre 2014

Searching a dictionary in perl?


I'm new to perl


I want to write a program that will look up a word provided by the user as an argument then search and display the definition of the input word from the file “dictionary.txt” file (provided below).


The dictionary.txt contains dictionary definitions, one per line, in the format ``word space definition''.



% cat dictionary.txt
delight Great pleasure or gratification; joy
deuteron The nucleus of a deuterium atom
distribution The act of distributing or the condition of being distributed
fiche A microfiche
karate A Japanese art of self-defense
rinse To wash lightly with water
rouge A red or pink cosmetic for coloring the cheeks or lips
slack Not lively or moving; sluggish
%


How can I achieve this Using the three-argument form of split() in perl?



Aucun commentaire:

Enregistrer un commentaire