Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: random elements from array - new twist

by pizza_milkshake (Monk)
on Nov 07, 2002 at 03:06 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://210988]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-04-23 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found