http://www.perlmonks.org?node_id=567852


in reply to What I Most Recently Learned in Perl, But Should Have Already Known

One thing that bit me a few months ago: sort in scalar context is undefined.

That isn't a big deal until you do this in a sub:

return( sort @some_array );

that is supposed to return a sorted list. And then you wonder how many elements the list contains:

my $count = get_the_sorted_list(); #Scalar context propagates to sort

That's pretty annoying when you happen to do it, and pretty important to know about so you don't. I sure was surprised the first time I encountered it.

/J