ginocapelli has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -wT use strict; use CGI; my $line = ""; my $part = ""; my $adfile = 'banners.dat'; open(FILE, $adfile) || die "Can't open $adfile"; #srand; # This chooses a random line, and puts that line into # the var $line. rand($.) < 1 && ($line = $_) while <FILE>; # This gets rid of the space at the end on each line chop $line; # Now you can split it my @part = split(/\|/,$line); # Close the file close(FILE); # Display the banner print "Content-type: text/html\n\n"; print "<font face=\"arial\" size=\"2\"><a class=\"banner\" href=\" +@part[0]\" target=\"_blank\"><img src=\"@part[1]\" width=\"@part[2]\" + height=\"@part[3]\" alt=\"@part[4]\" border=\"1\"><br>Click here to +visit my sponsor! </a></font>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I print all lines instead of 1 random?
by CheeseLord (Deacon) on Aug 20, 2001 at 04:39 UTC | |
by tilly (Archbishop) on Aug 20, 2001 at 05:50 UTC | |
by ginocapelli (Acolyte) on Aug 20, 2001 at 07:22 UTC | |
by CheeseLord (Deacon) on Aug 20, 2001 at 07:37 UTC | |
|
Re: How can I print all lines instead of 1 random?
by blakem (Monsignor) on Aug 20, 2001 at 04:35 UTC | |
|
Re: How can I print all lines instead of 1 random?
by George_Sherston (Vicar) on Aug 20, 2001 at 13:49 UTC | |
by ginocapelli (Acolyte) on Aug 21, 2001 at 01:36 UTC |