my $n=1; open (LOG, "log/anuncis.txt") || die "$!"; while () { chomp; my @attributes = split /\|/; if ($attributes[0] =~m/Di*/){ print "\n"; print "Anunci número $n del $attributes[0]\n"; print "De $attributes[1] $attributes[2] que vol vendre $attributes[6] a $attributes[7] ?.\n"; print "Us hi podeu posar en contacte al(s) telèfon(s) $attributes[8] // $attributes[9]\n"; print "Segons l'horari que ens indica: $attributes[5]\n"; print "O bé al correu electrònic: $attributes[10] o a la seva URL $attributes[11]\n"; print "AQUESTS SÓN ELS SEUS COMENTARIS:\n"; print "
$attributes[12]
\n"; print "

\n";} else{ print "\n"; print "Anuncio número $n del $attributes[0]\n"; print "De $attributes[1] $attributes[2] que desea vender $attributes[6] a $attributes[7] ?.\n"; print "Os podéis poner en contacto con el/ella en los teléfonos $attributes[8] // $attributes[9]\n"; print "Según el horario que nos idica: $attributes[5]\n"; print "Su e-Mail es: $attributes[10] y su URL: $attributes[11]\n"; print "ESTOS SON SUS COMENTARIOS:\n"; print "
$attributes[12]
\n"; print "

\n";} $n++; } close LOG;