Kuntent has asked for the wisdom of the Perl Monks concerning the following question:
It's supposed to print only the atrributes in each line, which it does, but it shows me as many messages as attributes the user has input. How can I solve it? Any idea? Thank you very much in advance#!/usr/bin/perl -wT #author: Kunt Unt #Creation date: 10/06/2002 use strict; my $n=1; open (LOG, "anuncis.txt") || die "$!"; while (<LOG>) { chomp; my @attributes = split /\|/; foreach my $attribute (@attributes) { print "<TABLE WIDTH=65% BORDER=1 ALIGN=CENTER>\n"; print "<TR BGCOLOR=#00FF00B>Anunci número $n del $attribut +es[0]</TR>\n"; print "<TR>De $attributes[1] $attributes[2] que vol vendre + $attributes[6] a $attributes[7] €.</TR>\n"; print "<TR>Us hi podeu posar en contacte al(s) telèfon(s) +$attributes[8] // $attributes[9]</TR>\n"; print "<TR>Segons l'horari que ens indica: $attributes[5]< +/TR>\n"; print "<TR>O bé al correu electrònic $attributes[10] o a l +a seva URL $attributes[11]</TR>\n"; print "<TR>Aquests són els seus comentaris:\n"; print "<P> <FONT COLOR=#DAA520>$attributes[12]</TR></TABLE +>\n"; print "<BR><BR>\n"; } $n++; } close LOG; print qq(<HR>Retorn a la nostra pàgina <a href="http://localhost/anunc +is.htm"> principal</a>);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Too many outputs
by derby (Abbot) on Jun 12, 2002 at 19:02 UTC | |
by Kuntent (Initiate) on Jun 12, 2002 at 21:01 UTC | |
|
Re: Too many outputs
by George_Sherston (Vicar) on Jun 12, 2002 at 19:04 UTC |