Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Random string generator

by t'mo (Pilgrim)
on Feb 06, 2003 at 15:58 UTC ( #233165=note: print w/replies, xml ) Need Help??

in reply to Random string generator

Thanks to jmcnamara, we have this example:

perl -le 'print map{(a..z)[rand 26]} 0..rand 10'

which I have extended thusly:

perl -le 'print map{(a..z,A..Z,0..9)[rand 62]} 0..7'

and which you could extend as needed.

Replies are listed 'Best First'.
Re^2: Random string generator
by glenn (Scribe) on Mar 11, 2016 at 15:11 UTC
    For use in a function which is much easier to remember.
    print randStr(8)."\n"; sub randStr { return join('', map{('a'..'z','A'..'Z',0..9)[rand 62]} 0..shift); }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2016-10-28 12:39 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (383 votes). Check out past polls.