Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: random elements from array - new twist

by pizza_milkshake (Monk)
on Nov 07, 2002 at 03:06 UTC ( #210988=note: print w/replies, xml ) Need Help??


in reply to random elements from array - new twist

#!/usr/bin/perl -l use strict; my @a = 1..15; my ($tmp, %h); while (keys %h < 5){ $tmp = $a[rand @a]; $h{$tmp}++ unless $h{$tmp}; } print for keys %h;
perl -e'$_=q#: 13_2: 12/"{>: 8_4) (_4: 6/2"-2; 3;-2"\2: 5/7\_/\7: 12m m::#;s#:#\n#g;s#(\D)(\d+)#$1x$2#ge;print'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2020-10-25 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?