$articles[int(rand($#articles + 1))]The usual idiom for this is simply:
This is where it is useful to know the difference between @articles and $#articles, and that indexing automatically truncates to an integer.$articles[rand @articles]
Also, see my column on random phrase generators.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re: Random nonsense generator
by merlyn
in thread Random nonsense generator
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |