in reply to global, write-able vars
I don't recommend this, but if you purposely use a global variable why bother passing it to a subroutine? Global is global.
use strict; use warnings; my $global = 1; mt(); print "C: global still = $global\n"; sub mt { print "A: global=$global\n"; $global++; print "B: global=$global\n"; } __END__ A: global=1 B: global=2 C: global still = 2
|
|---|