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; }
In reply to Re: Matching a KEY in a HASH
by suaveant
in thread Matching a KEY in a HASH
by SysAdm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |