in reply to Format question...
format RECEIPT_TOP = Item Quantity Price -------------------------------------------- . format RECEIPT = @<<<<<<<<<<<<<<<<<<<<< @<<<<< @####.## @format_row . for my $row_ref ( @$cartItemsRef ) { @format_row = @$row_ref; write RECEIPT; # this writes to the filehandle RECEIPT }
You can read up more on formats with perldoc perlform.
And maybe you should consider another solution altogether like using a templating system, e.g. TT2 or Text::Template.
Update: The code above only works if you retreive exactly these three columns (in the order you use them in the template) from the database. Otherwise the @format_row = ... line has to be adjusted accordingly.
-- Hofmator
|
|---|