Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: What I Most Recently Learned in Perl, But Should Have Already Known

by jplindstrom (Monsignor)
on Aug 17, 2006 at 08:34 UTC ( [id://567852]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://567852]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found