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