Hi Richard, > I was frantically reading about the scope of variables. My background > is Algol 60 and PLI where a block is a compound statement with local > declarations. I gather in Perl it's the other way round.
No, I think it's the same as those language, C. Running $n = 1; sub foo { print "b $n\n"; my $n = 2; print "c $n\n"; for (my $i = 0; $i < 2; $i++) { print "d $n\n"; if ($i == 0) { my $n = 3; # Never printed. } else { $n = 4; # No my. } print "e $n\n"; } print "f $n\n"; } print "a $n\n"; foo; print "g $n\n"; gives a 1 b 1 c 2 d 2 e 2 d 2 e 4 f 4 g 1 > I hear what you say about C++, but I find it easier than Python. If that's because you like its types-defined-at-compile-time nature then Go will appeal. func main() { type ( foo int bar int ) var ( f foo b bar ) f = 42 b = f } "cannot use f (type foo) as type bar in assignment". -- Cheers, Ralph. https://plus.google.com/+RalphCorderoy _______________________________________________ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer