Hi ,all :

I want to know if there is a way in which I can randomnize(?) the content in
an array.

In this example :

my @array = ('uriel', 'daniel', 'joel', 'samuel');

Now what I want is create a process so every time I print the array it
prints  one element from the array .

I wrote it like this :

#!/usr/bin/perl -w

use strict;

my @array = ('uriel', 'daniel', 'joel', 'samuel');
print "Array before random: @array\n\n";

print "Array of random: $array[rand @array]\n";


I thoght it might work but it doesnt. I hope someone could give me an
idea to work this out...

Reply via email to