Kammen van, Marco, Springer SBM NL wrote:
Hi All,

Hello,

I'm trying to generate random sentences using a few words, but can't get
the thing to work...... I know I'm doing something wrong but what? :-D

Any help is appreciated!


#!/usr/bin/perl -w

#!/usr/bin/perl
use warnings;
use strict;

#

my $count = "0";

my $count = 0;

my $word0 = "aap";
my $word1 = "nood";
my $word2 = "mies";
my $word3 = "boot";
my $word4 = "pet";
my $word5 = "boom";
my $word6 = "klok";
my $word7 = "bel";
my $word8 = "fiets";
my $word9 = "toeter";

my @words = qw/
    aap
    nood
    mies
    boot
    pet
    boom
    klok
    bel
    fiets
    toeter
    /;

while ($count < 5) {
  ++$count;
  print "Test number $count\n";
  wordgen();
}

foreach my $count ( 1 .. 5 ) {
    print "Test number $count\n",
          "firstword is $words[ rand @words ]\n";
    }

sub wordgen {
  my $number = int(rand(10));
  $firstword = $word{$number};
  print "firstword is $firstword\n";
}


John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to