http://qs321.pair.com?node_id=200006

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am opening a file that is new-line delimited , I am doing a while loop over the file handle. I am trying append each line to a variable until i've passed over 20 lines. below is my code.
open(FILE, $listfile); while(my $user = <FILE>) { $user =~ s/(\r|\n)//; # windows compatibility $userout .="$user,"; $lcount++; if ($lcount == 20) { print PIPE "$userout"; $lcount=0; } next if !$user; }
any help is appreciated