Pick random element: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: using a constant (making code shorter and showing that there is no side-effect) |
m →{{header|Perl}}: using qw |
||
Line 329: | Line 329: | ||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
<lang perl>my @array = ( |
<lang perl>my @array = qw(a b c); |
||
print $array[ rand @array ];</lang> |
print $array[ rand @array ];</lang> |
||