my $first = 1; while (...) { print ',' unless $first; undef $first; print "..."; # print the sentence }