On Sat, 2011-02-12 at 12:50 -0700, Tom Christiansen wrote: > > - @chars = map(chr, @nums); > > + my @chars = map(chr, @numbers); > > I am of the studied opinion that slavishly added declarations that > have no bearing on the semantics of the function demonstrated serve > only to make that snippet less clear and more confusing. > This was a specific principal I followed when last I edited perlfunc. > > Notice that you aren't declaring and initializing @numbers, which > makes this edit inconsistent and confusing. See where this leads? > These are not complete programs, and needn't be portrayed as such. > > What's next? > > my $decimal = 3.678; > my $whole = int($decimal); I also dislike patches that blindly add 'use strict;' and 'my' to code samples in perl documentation, but in this particular case it could be argued that example demonstrates collecting values into new-ly created array, so 'my' is fine here, although not really necessary update. Regards, Vadim.Thread Previous | Thread Next