First always use strictures (use strict; use warnings;). That will tell you that \a, \d, \# and \h are not what you expect. It would also tell you that you are redefining $key which is probably not what you meant.
You seem to be confusing the roles of $key and $line.
Your regex matches a bunch of weird characters. It may be that you mean to match the complement of the set, in which case the set should start [^.
You would likely get much better answers if you told us what the problem is that you are trying to solve and showed us a little more of the code. It looks like you are trying to manipulate paths - you've already been told several times about modules that will help you with that.
In reply to Re: unable to fomulate right regular expression to fetch the intermediate and last word from a line (windows path) using delimiter "\"
by GrandFather
in thread unable to fomulate right regular expression to fetch the intermediate and last word from a line (windows path) using delimiter "\"
by suniln
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |