Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It looks like you got what you were looking for, but in the future, for formatting text into tables you should check out Perl6::Form. Here's a simple (recycled) example that would get you started:
#!/usr/bin/perl -w use strict; use Perl6::Form; my @barcodes=qw/8129348 2354234 234234534 21342134 23453421/; my @prices = qw/625.50 626.35 234.23 546.54 3245.45/; my @quants = qw/2 2 34 4 6/; my @values = qw/21345 345345 345345 3453 34534/; my $total = 0; foreach(@values){$total+=$_}; print form ' ============================================================', '| Goods in Stock |', '|===========================================================|', '| Barcode | Price | Quantity | Value |', '|-------------+---------------+-------------+---------------|', '| {[[[[[[[[[} | {$]]]]]].[[[} | {]]]]]]]]]} | {$]]]]]]].[[[}|', \@barcodes, \@prices, \@quants, \@values, '|===========================================================|', '| Total Value In Stock {$]]]]]]].[[[}|', $total, ' =========================================================== ', ;

Produces:

=========================================================== | Goods in Stock | |===========================================================| | Barcode | Price | Quantity | Value | |-------------+---------------+-------------+---------------| | 8129348 | $625.5 | 2 | $21345.0 | | 2354234 | $626.35 | 2 | $345345.0 | | 234234534 | $234.23 | 34 | $345345.0 | | 21342134 | $546.54 | 4 | $3453.0 | | 23453421 | $3245.45 | 6 | $34534.0 | |===========================================================| | Total Value In Stock $750022.0 | ===========================================================

In reply to Re: Help with formatting a text file by moklevat
in thread Help with formatting a text file by noobee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-16 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found