Prev: export symbols
Next: Checking Perl 5.8.0 programs.
From: Marc Girod on 8 Jul 2010 04:32 On Jul 7, 7:11 pm, Marc Girod <marc.gi...(a)gmail.com> wrote: I was pointed the documentation (which I had failed to read well enough--embarrassing as this is the first paragraph): In list context, this sorts the LIST and returns the sorted list value. In scalar context, the behaviour of "sort()" is undefined. OK. Now I know that 'undefined' may mean 'stack corruption'. Cave canem... er, caveat emptor, I meant. The fix is thus: return wantarray? sort keys %co : scalar keys %co; Marc |