I have a file of names and addresses. Each name and address is over nine
lines (including blanks). I want  to use this file in a word document as an
address list.

My attempt so far has resulted in every line being printed nine times. Help
please...


#!/usr/contrib/bin/perl
# open the input file
open(INFILE,  '<address.txt');
# open the output
open(OUTFILE, '>addline.txt');
# read the whole file
#While there are lines in the infile
#For each 9 lines print the lines, print a new line, reset counter
while(<INFILE>)
    {
         $ThisLine = $_;
         {    for ($i = 1; $i <= 9; $i +=1)
                {print OUTFILE  $ThisLine; print OUTFILE ","; next}
        }
         print OUTFILE "\n";
         $i = 1;
    }
close(INFILE);
close(OUTFILE);




Cathy

Cathy Gear
e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to