in reply to Matching a KEY in a HASH
the \Q \E makes sure that you match the characters in $variable the way they are, (other a \ could screw you all up, or a . or a *, etc) and the i at the end makes it case-insensitive (often good in substring matching). Does that help?for(keys %category) { print "$category{$_}\n" if /\Q$variable\E/i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Matching a KEY in a HASH
by SysAdm (Novice) on May 14, 2001 at 21:44 UTC | |
by merlyn (Sage) on May 14, 2001 at 21:46 UTC | |
by suaveant (Parson) on May 14, 2001 at 22:18 UTC | |
by Daddio (Chaplain) on May 14, 2001 at 22:26 UTC | |
by SysAdm (Novice) on May 15, 2001 at 01:01 UTC |