in reply to RE: Random letters
in thread Random letters

You *could* do it that way. Here's what I came up with, just to be non-ASCII safe:
#!/usr/bin/perl -w use strict; my $offset = ord('A'); my $last = 26; if (@_) { $last = 52; } print "Random Character Printer. Press CTRL-D to stop.\n"; do { my $value = int rand(26) + $offset; print $value, "\t", chr($value); } while (<>);
Note that ASCII values between 91 and 97 inclusive may give you trouble, as A .. Z and a .. z aren't adjacent. You'll want to add a check for that. (Besides, I hadn't used a do-while loop in a while.)