NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
also a favourite (Score:1)
perl -le 'print chr(65+rand(26))'
your version is prettier, though
(sorry, i'm not a java person)
bgp is for those who can't keep it static long enough
Re:also a favourite (Score:2)
That can come across as slightly more documented if you say:
Then you don't have the potentially mystifying 65. (I fess up; I always have to look up the value of 'A' on an ASCII chart whenever I want to do anything like this.)
Some languages will basically treat 'A' as an int and allow you to drop the ord(). Not Perl. Might work for Java, though.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Reply to This
Parent
Re: (Score:1)
perl -le'$a="A";$a++for 1..rand 26;print$a'