Home : General : Perl Programming :

General: Perl Programming: Re: [Wil] Illegal variable name.: Edit Log

Here is the list of edits for this post
Re: [Wil] Illegal variable name.
That code is longer and slower than it needs to be. All you need is:

Code:

#!/usr/bin/perl

print "Content-type: text/html\n\n";

@html = ('index.apricot.html',
'index.butter.html',
'index.garden.html',
'index.greek.html',
'index.maple.html',
'index.raspberry.html',
'index.strawberry.html',
'index.natural.html');


my $rand = $html[rand @html];

open (H, "</home/fba/beta.rachelsorganic.co.uk/$rand");
while (<H>) { print; }
close H;

That will work with any version of perl. If it doesn't you screwed up your perl installation.

Also you don't need the int in [int rand @html] seeing as you aren't dealing with an integer Tongue

Last edited by:

RedRum: Nov 13, 2001, 5:35 AM

Edit Log: