sim has asked for the wisdom of the Perl Monks concerning the following question:
Hey I am trying to just write first simple perl script. Here what I am trying to do is pass the word which I want to find in array from command line. After that it should print all entries which contain that word. Say I want to find Jacob from command line but its not returning any result. Could u help me out
#! usr/bin/perl use Fcntl; print “content-type: text/html \n\n”; print “Enter word : “; $word = ; @myNames = (‘Jacob’, ‘Michael’, ‘Joshua’, ‘Matthew’, ‘Alexander’, ‘And +rew’); @grepNames = grep(/$word/, @myNames); foreach $Names(@grepNames) { print $Names; print “\n”; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: find words in array
by toolic (Bishop) on Aug 01, 2012 at 18:15 UTC | |
|
Re: find words in array
by thundergnat (Deacon) on Aug 01, 2012 at 18:34 UTC | |
|
Re: find words in array
by Rudolf (Pilgrim) on Aug 01, 2012 at 18:42 UTC | |
|
Re: find words in array
by Kenosis (Priest) on Aug 01, 2012 at 20:03 UTC |