in reply to Printing Random Image in HTML

Your code will print out multiple Location headers, because you don't stop after printing the first one. Also, you don't need to call srand.

Here's some code that will do the same job (hopefully):

open DAT, "ads.dat" or die "Can't open data file: $!"; my @valid = grep $_->[3] =~ /^internal|partner$/, map [ split /\|/ ], <DAT>; close DAT or die "Can't close data file: $!"; my $which = $valid[ rand @valid ]; print "Location: ", $which->[2], "\n\n";

Replies are listed 'Best First'.
RE: Re: Printing Random Image in HTML
by damian (Beadle) on Sep 13, 2000 at 11:25 UTC
    hi btrott, i think the code u've just suggested does not prints any images. thanks again.