wsee has asked for the wisdom of the Perl Monks concerning the following question:
Here is my code:
my %WORD = ('AALIYAH', 'AARON', 'ABBE' , 'ABBEY', 'ABBI', 'ABBIE', 'ABBIGAIL', 'ALEX'); $name = "ALEX B. WILLIAM"; $name =~ /^(\w+) /; print "WORD = $1\n" if (exists $WORD{$1});
If I re-organize the hash key into something like below, it will find "ALEX".
my %WORD = ('AALIYAH', 'AARON', 'ALEX', 'ABBE', 'ABBEY', 'ABBI', 'ABBIE', 'ABBIGAIL');
Any idea or suggestion?
Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exists in HASH issue
by simonm (Vicar) on Jul 21, 2003 at 22:26 UTC | |
|
Re: Exists in HASH issue
by jasonk (Parson) on Jul 21, 2003 at 22:27 UTC | |
|
(jeffa) Re: Exists in HASH issue
by jeffa (Bishop) on Jul 21, 2003 at 22:29 UTC | |
|
Re: Exists in HASH issue
by Zaxo (Archbishop) on Jul 21, 2003 at 22:34 UTC | |
|
Re: Exists in HASH issue
by bobn (Chaplain) on Jul 21, 2003 at 22:35 UTC | |
|
Re: Exists in HASH issue
by antirice (Priest) on Jul 21, 2003 at 22:31 UTC | |
|
Re: Exists in HASH issue
by runrig (Abbot) on Jul 21, 2003 at 22:34 UTC | |
|
Re: Exists in HASH issue
by snadra (Scribe) on Jul 22, 2003 at 08:17 UTC | |
|
Re: Exists in HASH issue
by Theo (Priest) on Jul 22, 2003 at 14:49 UTC |