Pick random element: Difference between revisions

Content deleted Content added
Grondilu (talk | contribs)
→‎{{header|Perl 6}}: using a constant (making code shorter and showing that there is no side-effect)
Grondilu (talk | contribs)
Line 329: Line 329:


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>my @array = ('a', 'b', 'c');
<lang perl>my @array = qw(a b c);
print $array[ rand @array ];</lang>
print $array[ rand @array ];</lang>