in reply to Constructing a hash - why isn't my regex matching anything
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Constructing a hash - why isn't my regex matching anything
by perl_mystery (Beadle) on Dec 19, 2010 at 08:42 UTC | |
by Anonymous Monk on Dec 19, 2010 at 08:58 UTC | |
by perl_mystery (Beadle) on Dec 19, 2010 at 09:05 UTC | |
by Anonymous Monk on Dec 19, 2010 at 09:12 UTC | |
by perl_mystery (Beadle) on Dec 19, 2010 at 09:23 UTC | |
|