Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Length of strings in an array

by shabird (Sexton)
on Sep 20, 2020 at 16:53 UTC ( [id://11121965]=note: print w/replies, xml ) Need Help??


in reply to Re: Length of strings in an array
in thread Length of strings in an array

Hello Athanasius Thank you for your explanation it helped but can you please explain what does this code { $a <=> $b } means?

Replies are listed 'Best First'.
Re^3: Length of strings in an array
by BillKSmith (Monsignor) on Sep 20, 2020 at 18:36 UTC
    Athanasius uses the sort BLOCK LIST syntax of sort. The block is {$a <=> $b}. Blocks are documented in Basic BLOCKS. The operator (<=>) is described in Equality Operators. The package variables $a and $b are described through out the documentation for sort. The short answer is that this block tells sort to sort the list in numerical order rather than the default lexical order.
    Bill

Log In?
Username:
Password:

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

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

    No recent polls found