Erasmo Perez wrote: > I would like to know how could I transform the following CSV file: ... > 1,2,3,4,5,6 ... > into the following CSV file: ... > 1,2 > 1,3 > 1,4 > 1,5 > 1,6
Gunnar Hjalmarsson wrote: > while (<>) { > chomp; > my ($first, @rest) = split /,/; > print "$first,$rest[$_]\n" for 0..$#rest; > } Rob Dixon wrote: > while (<DATA>) { > chomp; > my ($first, @data) = split /,/; > print "$first,$_\n" foreach @data; > } Beginner's golf. perl -F, -lane'print"$F[0],$F[$_]"for 1..$#F;' data -- Brad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/