in reply to help shorten this series of regexes
The below code works ...
I might not work the way you think. You are doing an assignment willy-nilly regardless of whether the matches succeed or not. For instance, if "Clay" was the value then lumber would get undef or whatever was in $1 from some previous match, $clay would get the right value but $iron and $crop would get the value associated with "Clay".
Always test that your matches have been successful.
Cheers,
JohnGG
|
|---|