in reply to Assign in loop with and without declaration
I just wonder since, after all, it does what I mean without warnings and my
Because without strict and warnings, the variable is a package variable, not a lexical variable. The strict version of your last example would be:
use strict; use warnings; use vars qw($j); # or "our $j;" $j = $_ for (1 ..3); ($j) ? print $j : warn "no warnings - missing";
|
|---|