Thanks to the forum here I am now aware of how to create and assign variables within an if statement to matched variables. Now I'm trying to set the same variable $m1 with the below statements. Only one pattern will evaluate true at a time, so how do I assign $m1 to only the one that evaluates true without evaluating the other (that seems to clear $m1 if the last pattern evaluated is false)? Thank you as always, the script is coming along perfectly!
Update:
In my effort to simplify, I did change one thing, which I believe makes things a bit more difficult; the 3rd matching statement is with a different string(output_2) to pattern match, so I rewrote it correctly below. That said, I believe what will make this work is to somehow only evaluate statements until one is shown to be true, then to breakout with $m1 set
if(my ($m1) = $output =~ /^(pattern1)$/ or my ($m1) = $output =~ /^(pa
+ttern2)$/ or my ($m1) = $output_2 =~ /(pattern3)/) {
$hash{$key} = $m1;
}