You're viewing a comment by Peteris Krumins and its responses.
You're viewing a comment by Peteris Krumins and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


q, really easy, the ("a".."z") part creates a list of all letters from a to z. You can think of it as putting all letters in an array:
perl -le '@letters = ("a".."z")'Next, this array can be indexed to choose individual letters from it. There are 26 letters in the alphabet so $letters[0] is "a" and $letters[1] is "b", ..., $letters[25] is "z".
Now what I do is I use rand function to choose some letter at random:
perl -le '@letters = ("a".."z"); print $letters[rand 26]'But you can skip the @letters array and just use ("a".."z") in its place:
perl -le 'print (("a".."z")[rand 26])'And I need to do this several times, so I create a loop that executes 8 times by using map function on a range 1..8,
perl -le 'print map { ("a".."z")[rand 26] } 1..8'That's it.
Reply To This Comment