in reply to where to declare a variable...
anything outside of the if {} will not see or be affected by the assignment of $test. but anything within sub main {} will be able to see $blah because it has been globally instantiated. Hope that helps.sub main { my $blah; if ($blah =~/(\d+)\s{2}/) { my $test = $1; } }
|
|---|