Chris Devers <[EMAIL PROTECTED]> wrote:

: I have a similar script on my site, but I use it to select
: a random stylesheet instead of a random image. Same idea
: though.
: 
:   #!/usr/bin/perl -w
: 
:   use strict;
:   use CGI;
: 
:   my $q = new CGI;
:   my @sheets = <*.css>;
: 
:   use List::Util 'shuffle';
:   @sheets    = shuffle( @sheets );

    Why shuffle it *and* pick a random one?

 
:   my $i     = rand @sheets;
:   my $sheet = $sheets[$i];
: 
:   print $q->redirect( $sheet );


use CGI;

my @sheets = <*.pl>;

print CGI::redirect( $sheets[ rand @sheets ] );

 
HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to