If you quote $key with /\Q$key\E/, that should give you what you want.
For more info, try perldoc perlre.
In reply to Re: Matching a variable in a fixed width file
by jsprat
in thread Matching a variable in a fixed width file
by aseidas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |