Hello,
I tried following code but it is not working. I have a file with many lines(records) where field separator is space. I want to convert rows to columns, something like... source: a b c d 1 2 3 4 output: a 1 b 2 c 3 d 4 Here is my test code: It is not working :( #!/usr/bin/perl use strict; use warnings; my ($IN_FH, $line,$string); my $rowfile= $ARGV[0]; my $colfile= $rowfile.".row2col"; open ($IN_FH,"<",$rowfile) or die "could not open $rowfile: $!"; #open ($OUT_FH,">",$colfile) or die "could not open $colfile: $!"; my $counter=1; while ($line = <IN_FH>) { chomp($line); my @arr_."$counter"=split(/ /,$line); $counter++; } close $IN_FH; for (my $i=1;$i<=150;$i++) { for (my $x=1;$x<=$counter;$x++) { $string .= $arr_."$x".[$i]." "; } print $string; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/