I thought I had done this before, but I guess not. I build a formt line for printf like:
q[%-3s%-4s%5s%6s];
But I want to insert a carriage return after say %-4s( I have a nubmer of fields and depending on the size, it is not a constant after column 2, but could be column 3 or 23.
I have tried:
q[%-3s%-4s] . qq[\\n] . q[%5s%6s]
or
q[%-3s%-4s\n%5s%6s]
But no matter what I do, it does not generate the carriage return. Shows up in the line. I know I am missing some very basic point, but has escaped me.
Here is the sample script I was playing with:
#!/usr/bin/perl
use strict;
use warnings;
my $MyLine1 = q[%2d %5s %6s];
my $MyLine2 = q[%2d %5s \n%6s];
printf "${MyLine1}\n",
2,
q[abc],
q[def];
printf "$MyLine2\n",
2,
q[abc],
q[def];
Thanks.
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight Systems
1.719.484.2097 Tel
1.719.484.2419 Fax
1.408.623.5963 Cell
http://fedex.com/us