in reply to scope of variables in a sub
Replace this:
elsif(($vsowner) = ($_ =~ /vs_owner =\s+(.*)/)){ print "VSOWNER:$vsowner\n"; }
With this:
elsif ( /vs_owner =\s+(.*)/ ){ $vsowner = $1; print "VSOWNER:$vsowner\n"; }
Your problem is that $vsowner is being set on one iteration of the loop, but being unset the next time around the loop.
Fix your other if/elsif checks too.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scope of variables in a sub
by GrandFather (Saint) on Sep 24, 2020 at 00:39 UTC | |
by tobyink (Canon) on Sep 24, 2020 at 10:29 UTC | |
by GrandFather (Saint) on Sep 24, 2020 at 21:04 UTC | |
by perlfan (Parson) on Sep 24, 2020 at 02:56 UTC | |
|
Re^2: scope of variables in a sub
by frontrange (Novice) on Sep 24, 2020 at 03:09 UTC |