We don't bite newbies here... much | |
PerlMonks |
Re: scope of variables in a subby jwkrahn (Abbot) |
on Sep 24, 2020 at 01:31 UTC ( [id://11122145]=note: print w/replies, xml ) | Need Help?? |
The first time through the outer foreach loop /filter_name =\s+(.*)/ matches so it goes through the inner loop where /REGEXP =\s+(.*)/ and then /OWNER =\s+(.*)/ and then /GROUP =\s+(.*)/ match in turn. The second time through the outer foreach loop /vs_name =\s+(.*)/ matches. The third time through the outer foreach loop /vs_owner =\s+(.*)/ matches. Because of the way you capture the variable data, if the outer loop iterates again the regular expressions will not match and the variable $vsowner will cleared (set to undef). Change each if/elsif expression from:
To:
In Section
Seekers of Perl Wisdom
|
|