in reply to Re^6: handling tab delimited files
in thread handling tab delimited files
I want to insert a header to the output file
Just print it :) — before printing the rows with the numbers:
print "my header ...\n"; while (<FILE>){ ...
I want the results to be printed in a new file.
Either redirect the program's output (stdout) to a file using the shell, or explicitly open another file for output, and then print to that file handle:
... open OUTFILE, ">", "outfile.txt" or die $!; print OUTFILE "my header ...\n"; while (<FILE>){ print OUTFILE join("\t", map { $_ * $df * 50 } split /\t/), "\n"; }
it has to be 7 X 10. how should i set values to 7 columns X 10 rows ?
There isn't really anything to "set". If you print 10 lines (rows) with each containing 7 tab separated values, you're done, essentially... i.e. the file will have 7 columns X 10 rows. This would happen without further ado (with the code we have so far), provided the input file also has the same dimensions (which is seems to have (at least the columns), judging by your sample data).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: handling tab delimited files
by shaludr (Initiate) on May 06, 2010 at 05:49 UTC |