On Oct 24, 2006, at 5:02 AM, Kåre Edvardsen wrote:
Hi all!
I have like 30 columns I'd like to write to a file using 'wcols' with
various formatted output. Do I need to write the format code for each
of the columns or is there any way to have one format code work
m-times before another format code work n-times and so on? Could not
find any working solution yet for this.
Kare _______________________________________________
Well, you can use the basic perl "x" operator to repeat the format
string n times. For example
perldl> p "%10.3f " x 2 . "%g " x 3 . "%.2e"
%10.3f %10.3f %g %g %g %.2e
so you could say something like
$format = "%10.3f " x 2 . "%g " x 3 . "%.2e" ;
wcols $format, ...
HTH,
Doug
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl