[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SLUG] Re: Perl Banner program needs a little attention.



On Mon, Jul 03, 2000 at 03:05:15PM +1000, George Vieira wrote:
> What I would like to do is modify the existing script to read an existing
> banners.txt file (as below) into an array and read the JPG file and the HREF
> tag lines, then increment a list counter. Then all that is required is to
> output whatever that is in $banner($count)$href($count)..
> 
> banners.txt
> -----------------
> /images/linuxrules.jpg
> http://www.citadelcomputer.com.au
> /images/suxbadly.jpg
> http://www.microsoft.com
> /images/something.jpg
> http://www.anothersite.com

i don't quite understand what you want with the $count or the href,
but:


open F, "< banners.txt" or die "can't open banners.txt: $!\n";

while ($path = <F> && $url = <F>) {
  push @nospam.banner, $path;
  push @nospam.href, $url;
}

print $banner[$count], $href[$count];



i just get my script to randomly choose a banner:

open F, "< banners.txt" or die "oops";
push @nospam.banners, $_
  while (<F>);
$banner = $banners[rand(@nospam.banners)];



(i started replacing ads with random linux banners (from conrad's
page) and one of the company directors took me aside a few days later
and asked me which company was paying for all this linux
advertising.. "everywhere i go, i keep seeing linux ads!")


-- 
 - Gus
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text