Re: {SPAM?} Re: [SLUG] Free Gmail Raffle: updated script

From: Dylan William Hardison (dylanwh@tampabay.rr.com)
Date: Fri Jun 11 2004 - 13:42:27 EDT


#!/usr/bin/perl

use strict;
use warnings;

my @people = (
        "Dylan",
        "Levi",
);

my $victim = pick_person(\@people);
print "And the winner is: $victim!\n";

sub randint {
        open my $hat, "/dev/random" or die "Can't open /dev/random: $!";
        my $buf;
        read $hat, $buf, 1;
        close $hat;
        return ord($buf);
}

sub pick_person {
        my ($people) = @_;

        # Thanks to Levi for reminding me
        # of the properties of %.
        my $i = randint() % @people;
        return $people->[$i];
}

-- 
...the number of UNIX installations has grown to 10, with more expected...
              -- Dennis Ritchie and Ken Thompson, June 1972
-
GPG Fingerprint=D67D 2B75 53C6 9769 30E4  D390 239F C833 F32C F6F6
GPG KeyID=F32CF6F6
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:26:28 EDT