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 6938 Sep 27, 2001, 12:33 PM
Thread Re: [Canoon] Random Perl Global
Paul 6874 Sep 27, 2001, 1:02 PM
Thread Re: [RedRum] Random Perl Global
Canoon 6867 Sep 27, 2001, 1:10 PM
Post Re: [Canoon] Random Perl Global
Paul 6821 Sep 27, 2001, 1:14 PM
Thread Re: [Canoon] Random Perl Global
Paul 6818 Sep 27, 2001, 1:16 PM
Thread Re: [RedRum] Random Perl Global
Canoon 6857 Sep 27, 2001, 1:32 PM
Thread Re: [Canoon] Random Perl Global
Paul 6811 Sep 27, 2001, 1:35 PM
Post Re: [RedRum] Random Perl Global
Canoon 6820 Sep 27, 2001, 1:41 PM
Thread Re: [RedRum] Random Perl Global
Paul 6819 Sep 27, 2001, 1:52 PM
Thread Re: [RedRum] Random Perl Global
Canoon 6858 Sep 27, 2001, 1:57 PM
Thread Re: [Canoon] Random Perl Global
Alex 6804 Sep 27, 2001, 2:53 PM
Thread Re: [Alex] Random Perl Global
Canoon 6830 Sep 27, 2001, 3:06 PM
Thread Re: [Canoon] Random Perl Global
Alex 6796 Sep 27, 2001, 3:13 PM
Thread Re: [Alex] Random Perl Global
Canoon 6862 Sep 27, 2001, 3:21 PM
Thread Re: [Canoon] Random Perl Global
Alex 6814 Sep 27, 2001, 3:26 PM
Post Re: [Alex] Random Perl Global
Canoon 6789 Sep 27, 2001, 3:35 PM
Post Re: [Alex] Random Perl Global
Paul 6765 Sep 28, 2001, 3:49 AM
Post Re: [Alex] Random Perl Global
Sir Up 6663 May 24, 2002, 8:44 AM