Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: How to get the index of smallest whole number in an array?

by johngg (Canon)
on Jul 01, 2018 at 15:33 UTC ( [id://1217702]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to get the index of smallest whole number in an array?
in thread How to get the index of smallest whole number in an array?

The () there is part of a ternary -

map $x[$_] >= 0 && $x[$_] == int $x[$_] ? [ $_ => $x[$_] ] : (),

- where the current element of the @x array is tested the see if it is greater or equal to zero and if it is a whole number. If true an anonymous array is passed to the sort routine, if false then an empty list (i.e. nothing) is passed. This construct operates pretty much like grep to filter out any values that don't satisfy the conditions.

Cheers,

JohnGG

Log In?
Username:
Password:

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

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

    No recent polls found