Gossamer Forum
Quote Reply
Random Perl Global
Hi!,

Bringing this back up from a old post as its more relevant to this forum.

I'm trying to add a random number via a global tag but no luck as I know nowt about programming. The output needs letters and numbers and be as accurate (random) as possible.

So far I have code below but it doesn't work (errors):

<%random%>

sub {
# Displays random number/letter.
my @dig = ('0..9', 'a..z', 'A..Z');
srand(time ^ $$);
for (my $i = 0; $i++ < 8;) {
$RAND .= $dig[rand(@dig)];
}
}

any help with this would be great and I'm sure other could use this too.

Subject Author Views Date
Thread Random Perl Global Canoon 8675 Sep 27, 2001, 12:33 PM
Thread Re: [Canoon] Random Perl Global
Paul 8598 Sep 27, 2001, 1:02 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8586 Sep 27, 2001, 1:10 PM
Post Re: [Canoon] Random Perl Global
Paul 8525 Sep 27, 2001, 1:14 PM
Thread Re: [Canoon] Random Perl Global
Paul 8539 Sep 27, 2001, 1:16 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8580 Sep 27, 2001, 1:32 PM
Thread Re: [Canoon] Random Perl Global
Paul 8535 Sep 27, 2001, 1:35 PM
Post Re: [RedRum] Random Perl Global
Canoon 8523 Sep 27, 2001, 1:41 PM
Thread Re: [RedRum] Random Perl Global
Paul 8540 Sep 27, 2001, 1:52 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8563 Sep 27, 2001, 1:57 PM
Thread Re: [Canoon] Random Perl Global
Alex 8525 Sep 27, 2001, 2:53 PM
Thread Re: [Alex] Random Perl Global
Canoon 8549 Sep 27, 2001, 3:06 PM
Thread Re: [Canoon] Random Perl Global
Alex 8512 Sep 27, 2001, 3:13 PM
Thread Re: [Alex] Random Perl Global
Canoon 8585 Sep 27, 2001, 3:21 PM
Thread Re: [Canoon] Random Perl Global
Alex 8533 Sep 27, 2001, 3:26 PM
Post Re: [Alex] Random Perl Global
Canoon 8498 Sep 27, 2001, 3:35 PM
Post Re: [Alex] Random Perl Global
Paul 8471 Sep 28, 2001, 3:49 AM
Post Re: [Alex] Random Perl Global
Sir Up 8367 May 24, 2002, 8:44 AM