in reply to elegant array assignment
In general, I find that code like that is attempting to compensate for "clever" code elsewhere. And, by "clever", I mean "poorly written". I'm betting that whatever populates $x does something like:
That meme is one of the most horrendous ones to work with.sub some_function { # Stuff here that populates @x return @x > 1 ? \@x : $x[0]; }
So, given that the proper normalization (as performed by sane callers) is to an array, why is some_function() normalizing to a scalar? Simply put, there's no good reason to, other than FUD. Remove the FUD, trust the array, and stop the silliness.
|
|---|