in reply to help shorten this series of regexes
Warnings about using regular expressions for HTML parsing aside, here is one approach that extracts data according to your pattern into a hash (named %price at a guess):
Annomy $html = <<EOT; stuff Lumber:</td><td align="right"><b>10 more stuff Clay:</td><td align="right"><b>20 glug Iron:</td><td align="right"><b>30 blub Crop:</td><td align="right"><b>40 stuff again EOT my %price; $price{ lc $1} = $2 while $html =~ m#(\w+):</td><td align="right"><b>(\d+)#ig; my ( $lumber, $clay, $iron, $crop) = @price{ qw( lumber clay iron crop)};
|
---|