Please let me know if anyone can give me that one line code that I need to put in my perl program that will really help me with my school homework.
I am very new to perl and struggling to write this simple program.
I have to write a CGI program that, given a user-specified search string, finds all words
(based on my /usr/share/dict/words file) that match this search string.
For example if I type " AN " in the search panel, the program will show me the related words from the dict file:
ANomaly
ANatomy
ANonymously
If I type "JAN" in the search panel, the program will show me:
JANuary
JANet
JANmiller
and so on ..
So far I came up with these set of codes:
$search='an'; open(W,"/usr/share/dict/words); while (<W>) { print if m/$search/; }
but it only searches for "an". What if I want to search for any word ?? What would the search string be ?
Help please
------------------------------------------------
Please help me. Regards, MashIn reply to Need Simple Perl Help plz by mashficool
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |