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 8626 Sep 27, 2001, 12:33 PM
Thread Re: [Canoon] Random Perl Global
Paul 8551 Sep 27, 2001, 1:02 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8539 Sep 27, 2001, 1:10 PM
Post Re: [Canoon] Random Perl Global
Paul 8478 Sep 27, 2001, 1:14 PM
Thread Re: [Canoon] Random Perl Global
Paul 8492 Sep 27, 2001, 1:16 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8533 Sep 27, 2001, 1:32 PM
Thread Re: [Canoon] Random Perl Global
Paul 8488 Sep 27, 2001, 1:35 PM
Post Re: [RedRum] Random Perl Global
Canoon 8476 Sep 27, 2001, 1:41 PM
Thread Re: [RedRum] Random Perl Global
Paul 8493 Sep 27, 2001, 1:52 PM
Thread Re: [RedRum] Random Perl Global
Canoon 8516 Sep 27, 2001, 1:57 PM
Thread Re: [Canoon] Random Perl Global
Alex 8479 Sep 27, 2001, 2:53 PM
Thread Re: [Alex] Random Perl Global
Canoon 8503 Sep 27, 2001, 3:06 PM
Thread Re: [Canoon] Random Perl Global
Alex 8466 Sep 27, 2001, 3:13 PM
Thread Re: [Alex] Random Perl Global
Canoon 8539 Sep 27, 2001, 3:21 PM
Thread Re: [Canoon] Random Perl Global
Alex 8487 Sep 27, 2001, 3:26 PM
Post Re: [Alex] Random Perl Global
Canoon 8452 Sep 27, 2001, 3:35 PM
Post Re: [Alex] Random Perl Global
Paul 8425 Sep 28, 2001, 3:49 AM
Post Re: [Alex] Random Perl Global
Sir Up 8320 May 24, 2002, 8:44 AM