in reply to regex question
The match runs to completion before the map even starts.
At the time your map runs, $1 and $2 are what they are at the end of the global match.
Most likely you want pairs from List::Util:
foreach my $pair ( pairs /(\d+)\s+(\S+)/mg ) { my ( $key, $value ) = @$pair; ... }
... or a while loop:
$h{ $1 } = $2 while /(\d+)\s+(\S+)/mg;
|
---|