#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; while (<>) { if (my ($key, $value) = /\.\\(.+?)-\d+;(.+?)\s-\s/) { $hash{$key} = $value; } else { warn "couldn't match key and value on line $."; } } print Dumper(\%hash);
In reply to Re: Constructing a hash - why isn't my regex matching anything
by Anonymous Monk
in thread Constructing a hash - why isn't my regex matching anything
by perl_mystery
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |