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 7849 Sep 27, 2001, 12:33 PM
Thread Re: [Canoon] Random Perl Global
Paul 7775 Sep 27, 2001, 1:02 PM
Thread Re: [RedRum] Random Perl Global
Canoon 7768 Sep 27, 2001, 1:10 PM
Post Re: [Canoon] Random Perl Global
Paul 7714 Sep 27, 2001, 1:14 PM
Thread Re: [Canoon] Random Perl Global
Paul 7720 Sep 27, 2001, 1:16 PM
Thread Re: [RedRum] Random Perl Global
Canoon 7761 Sep 27, 2001, 1:32 PM
Thread Re: [Canoon] Random Perl Global
Paul 7715 Sep 27, 2001, 1:35 PM
Post Re: [RedRum] Random Perl Global
Canoon 7712 Sep 27, 2001, 1:41 PM
Thread Re: [RedRum] Random Perl Global
Paul 7724 Sep 27, 2001, 1:52 PM
Thread Re: [RedRum] Random Perl Global
Canoon 7748 Sep 27, 2001, 1:57 PM
Thread Re: [Canoon] Random Perl Global
Alex 7706 Sep 27, 2001, 2:53 PM
Thread Re: [Alex] Random Perl Global
Canoon 7732 Sep 27, 2001, 3:06 PM
Thread Re: [Canoon] Random Perl Global
Alex 7695 Sep 27, 2001, 3:13 PM
Thread Re: [Alex] Random Perl Global
Canoon 7768 Sep 27, 2001, 3:21 PM
Thread Re: [Canoon] Random Perl Global
Alex 7714 Sep 27, 2001, 3:26 PM
Post Re: [Alex] Random Perl Global
Canoon 7685 Sep 27, 2001, 3:35 PM
Post Re: [Alex] Random Perl Global
Paul 7660 Sep 28, 2001, 3:49 AM
Post Re: [Alex] Random Perl Global
Sir Up 7555 May 24, 2002, 8:44 AM