Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Idiom to return 0 or random number of array elements

by LanX (Sage)
on Dec 07, 2012 at 05:48 UTC ( #1007690=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<130>  @array=a..c
     => ("a", "b", "c")
    ...
     
      DB<135> @array[0 .. -1 + int rand 1+ @array]
     => ("a", "b")
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2022-10-06 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (26 votes). Check out past polls.

    Notices?