while ($term = shift @terms ) { print "$term"; print ", " if @terms; }