Hi all, I'm trying to build a forum for my student's web site but i'm new to=20 CGI-scripting and Perling and encounter some problems...(but Perl is=20 really great and i have a lot of fun with it !!). Here it is : When someone acces the forum via the browser, it hits a cgi that=20 outputs the lists of all the subjects posted in the forum. This list=20 is a text file updated any time a new subject is posted. To output=20 the list to the browser, i use a template for the HTML code and I'm=20 trying to make a loop to print the list while reading the template.=20 At that point i have a big problem because the loop prints 'n' times=20 the same subject (the first in the list), and 'n' is the total number=20 of subjects. Here is the code: ##open the index and swallow it =09open (INDEX, "<path:subjects.txt") or die "$!\n"; =09$nbSuj =3D <INDEX>; =09@index =3D <INDEX>; =09close (INDEX); =09@rindex =3D reverse @index; ##open the template and print it to STDOUT =09open (TEMPL, "<path:forum.tmp"); =09while (<TEMPL>){ =09=09if ($. =3D=3D 1 .. 38){ =09=09$_ =3D~ s/%nbSuj%/$nbSuj/; =09=09print $_; ##the loop: =09=09}elsif ($. =3D=3D 40){ =09=09=09foreach $line(@rindex){ =09=09=09($ID, $Sujet, $nbRep, $Auteur, $date) =3D split(/,/, $line); =09=09=09$_=3D~ s/%ID%/$ID/; =09=09=09$_ =3D~ s/%Sujet%/$Sujet/; =09=09=09$_ =3D~ s/%Auteur%/$Auteur/; =09=09=09$_ =3D~ s/%date%/$date/; =09=09=09$_ =3D~ s/%nbRep%/$nbRep/; =09=09=09print $_; =09=09=09} =09=09}else{ print $_;} =09} =09close (TEMPL); the problem is that for each $line it does not reinitialize the=20 variables in $_ (hope i'm clear enough... but my english is so bad=20 :.(( Any advices most appreciated TIA Fred ---------------------------------------------------------------------- Fr=E9d=E9ric Guillaume -- frederic.guillaume@etu.unil.ch -- UniL-Biologie Chemin du Reposoir 23 - CH 1007 Lausanne - tel/fax: +41 21 617 03 73 - ---------------------------------------------------------------------- =3D=3D=3D=3D Want to unsubscribe from this list? =3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-webcgi-request@ma= cperl.org