One way to understand the result of the matching operation is to view it as a true/false value that indicates whether there is a match, and that's not what you wanted. To get what you want, do the following (you may have to further tweak your regexp, but that's a different story):
$line =~/;(.*)\s-\s/; my $key = $1; $line =~/\.\\(.*)-\d+\;/; my $value = $1;
In reply to Re: Constructing a hash - why isn't my regex matching anything
by PeterPeiGuo
in thread Constructing a hash - why isn't my regex matching anything
by perl_mystery
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |