Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Done it! Of course, you did give me just a teensy-weensy little hint, Chmrr... many thanks! Here's the final (?) version:

#!/usr/bin/perl use warnings; use strict; use CGI; ## Chmrr's revision, very slightly modified ## Column headings my @members = qw/ Algeria Indonesia Iran Iraq Kuwait Libya Nigeria Qat +ar Saudi_Arabia UAE Venezuela total_OPEC /; @members = map { tr/_/ /; $_ } @members; ## Load data my (%quotas, @dates); while (<DATA>) { ( my $period, $_ ) = split ':'; push @dates, $period; @{$quotas{$period}}{@members} = split ' '; } ## Introductory paragraph my $query = CGI->new(); print $query->header("text/html"), $query->start_html( -title => "QuotaBase: a database of OPEC oil p +roduction quotas", -bgcolor => "#cbcbcb" ), $query->h1("Welcome to QuotaBase!"), $query->table( $query->Tr( $query->td({-width => "600"}, $query->p(<<EOP) QuotaBase is an interactive database of OPEC oil production quotas. By + default, the <b>current quotas</b> are displayed. To view <b>histori +cal quota information</b>, select the period you want from the drop-d +own list and click the 'Show quotas' button. A table of all the quota +s for that period will be displayed. EOP ) ) ), $query->start_form(), "Choose a period: ", "&nbsp;", $query->popup_menu( -name=>'period', -values=>[@dates], -default=>(@dates)[0]), "&nbsp;&nbsp;", $query->submit(-name=>'submit', -value=>'Show quotas'), "&nbsp;&nbsp;", $query->defaults('Reset current quotas'), $query->endform; ## Data table my $period = $query->param('period') || (@dates)[0]; print $query->table({-border=>1}, $query->Tr( $query->td({-colspan=>2,-align=>"center +"},"<b>$period</b>") ), map { $query->Tr( $query->td({-width=>130,-align=>"left +" }, $_), $query->td({-width=>130,-align=>"righ +t"}, $quotas{$period}{$_}) ) } sort keys %{$quotas{$period}} ); print $query->end_html; __DATA__ Jan 02 - Dec 02: 693 1125 3186 0 1741 1162 1787 562 7053 1894 2 +497 21700 Sep 01 - Dec 01: 741 1203 3406 0 1861 1242 1911 601 7541 2025 2 +670 23201 Apr 01 - Aug 01: 773 1255 3552 0 1941 1296 1993 627 7865 2113 2 +786 24201 Feb 01 - Mar 01: 805 1307 3698 0 2021 1350 2075 653 8189 2201 2 +902 25201 31 Oct 00 - Jan 01: 853 1385 3917 0 2141 1431 2198 692 8674 2333 3 +077 26700 1 Oct 00 - 30 Oct 00: 837 1359 3844 0 2101 1404 2157 679 8512 2289 3 +019 26200

In reply to Re: Re: Re: Re: Confessions of an Initiate: a first Perl program by mooseboy
in thread Confessions of an Initiate: a first Perl program by mooseboy

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2014-07-13 00:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (242 votes), past polls