I probably wouldn't try to parse HTML using regular expressions, but since you didn't post an example of it I'll suggest the following:
my %hash; foreach my $type qw( Lumber Clay Iron Crop ) { if( $mech->content() =~ m#$type:</td><td align="right"><b>(\d+)#i +) { $hash{$type} = $1; # lc( $type ), etc if desired } else { # I dunno - what should happen if the match fails? } }
In reply to Re: help shorten this series of regexes
by bobf
in thread help shorten this series of regexes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |