List:General Discussion« Previous MessageNext Message »
From:Richard Reina Date:April 2 2000 4:27pm
Subject:Formatting question?
View as plain text  
When I run the following perl script:

 use DBI;
        my $db = DBI->connect("DBI:mysql:test",root,5492);
        my $query = "SELECT qteno, orgcity, orgstate, dstcity, dststate,
price, miles
        FROM oldqts WHERE (custno = $SearchFor)";
        my $oldqts_output = $db->prepare($query);
        $oldqts_output->execute;

        write;
        print DBI::dump_results($oldqts_output);
        # Print the output in a neat table.

        open(OLDQTS,">>oldqts");
        print DBI::dump_results($oldqts_output,\*OLDQTS);
        # Print the output again into the file 'oldqts'.
        $db->disconnect;

}

format STDOUT =
@<<<<<<<<
@<<<<<<<<<<<<<< 
@<<<<<<<<<< @<<<<<<<<
@<<<<<<
print DBI::dump_results($oldqts_output,\*OLDQTS);
.



format STDOUT_TOP =
Page @<<
$%

Quote
No.   Orgin            Destination       Rate      Miles
===== ================ ================  =======   ======
.

I get  this messy output despite my efforts to format it so that each
field is lined up in a straight column.  How can I  make the ouput line
up straight with columns headers on top?   Does anyone know what could
be wrong with my code?
Any help would be greatly appreciated.

'4', 'Lakebluff', 'IL', 'Milwaukee', 'WI', '485.00', '57.20'
'5', 'Lakebluff', 'IL', 'Milwaukee', 'WI', '485.00', '57.20'
'6', 'Lakebluff', 'IL', 'Milwaukee', 'WI', '485.00', '57.20'
'7', 'Lakebluff', 'IL', 'Milwaukee', 'WI', '485.00', '57.20'
'8', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'9', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'10', 'Lakebluff', 'IL', 'Rockford', 'IL', '495.00', '88.00'
'11', 'Lakebluff', 'IL', 'Rockford', 'IL', '495.00', '88.00'
'12', 'Lakebluff', 'IL', 'Rockford', 'IL', '495.00', '88.00'
'13', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'20', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'27', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'28', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'29', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
'58', 'Lakebluff', 'IL', 'Manteno', 'IL', '475.00', '77.20'
15 rows
15DBD::mysql::st fetch failed: fetch() without execute() at
/usr/lib/perl5/site_perl/DBI.pm line 581, <STDIN> chunk 11.

0 rows (19: fetch() without execute())
0





Thread
Formatting question?Richard Reina2 Apr