perl -pe 'goto LINE unless /\S/; s/\n/,/ if ($a = 1 - $a)'