in reply to Re: Re: Re: {} vs do{}
in thread {} vs do{}
does not compile, so whether the loop variable is set first or later or what the scope is is moot. For the list form,$value= "global"; do { print "Inside block: $value\n" } for (my $value= 5; $value < 7; ++$value);
It is intuative that it work the same way, one iteration per item in the list, and you can't use a variable, e.g.$_= 1; do { print "Inside block: $_\n" } for (5..7);
doesn't compile either. So variable scope issues are avoided.do { print "Inside block: $value\n" } for my $value (5..7);
Interesting.
—John
|
|---|