# New Ticket Created by AInaganti@bankofny.com
# Please include the string: [perl #27349]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27349 >
Hi,
We are having a problem with printing reports using perl format. Each
line on our report has to be 133 bytes where 133rd byte is a newline
character.
So we are padding the strings with white spaces. However on the report
the string is getting truncated ( all the white spaces towards the end
are getting truncated. Here is a sample script:
#!/usr/bin/perl
my $fileName ="/tmp/anita/tempreport.rpt";
my $reportTitle = " " x 49 . "AAA UNMATCHED TRADE STATUS REPORT" . " " x
50;
my $test = "Hello";
my $strlen = length($test);
my $newString = $test . " " x (132-$strlen)."\n";
#my $newString = sprintf("%-132s",$test);
my $slen = length($newString);
print "length = $slen \n";
open(OUTFILE, ">$fileName") or die "Can't open $fileName file\n";
write(OUTFILE);
format OUTFILE_TOP =
1+_________________________________________________________________________________________________________________________________+
@|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$reportTitle
PAGE: @##########
$%
+_________________________________________________________________________________________________________________________________+
.
format OUTFILE =
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$newString
.
exit 0
This is the output:
$ reportpadding.pl
length = 133
Here is the report:
1+_________________________________________________________________________________________________________________________________+
AAA UNMATCHED TRADE
STATUS REPORT
PAGE: 1
+_________________________________________________________________________________________________________________________________+
Hello
This is the version we are using:
This is perl, v5.6.1 built for aix-thread-multi
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 631 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 12:48:19 Mar 13 2002
Is this a known bug? If so was it fixed. Please let us know.
Thanks
Anita Inaganti
________________________________________________________________________
The information in this e-mail, and any attachment therein, is confidential and for use by the addressee only. If you are not the intended recipient, please return the e-mail to the sender and delete it from your computer. Although The Bank of New York attempts to sweep e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses.