in reply to Creating a random generator
Typical output is:#!/usr/bin/perl # use warnings; use strict; my @colors = qw(red yellow green cyan blue magenta white gray black); my $col = int(rand(scalar @colors)); print "Color = $colors[$col]\n";
C:\Code>perl choose_color_1.pl Color = magenta C:\Code>perl choose_color_1.pl Color = red C:\Code>perl choose_color_1.pl Color = black
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating a random generator
by Lady_Aleena (Priest) on Sep 07, 2007 at 07:46 UTC | |
by Corion (Patriarch) on Sep 07, 2007 at 08:04 UTC | |
by Lady_Aleena (Priest) on Sep 07, 2007 at 09:16 UTC | |
by Corion (Patriarch) on Sep 07, 2007 at 09:25 UTC | |
by Lady_Aleena (Priest) on Sep 07, 2007 at 19:04 UTC |