Please use <code> tags around your code, thusly:
#!/usr/bin/perl @skuid=("11021","11022","11023","92523002", "02196005","92196019","92176184","92305069", "92305070","92305054","14316002","92620206", "92503001"); @name=("mt. eden","dom perignon","veuve cliquot", "Arcadian Pinot Noir Sl Holl","Au Bon Climat Pinot Noir La Baug +e", "Au Bon Climat Pinot Noir Laetitia", "Bannister Pinot Noir Seghesio Vineyard", "Broadley Pinot Noir Claudias Choice", "Broadley Pinot Noir Marcille Loraine", "Broadley Pinot Noir Reserve","Castalia Pinot Noir Rochioli Vyd +", "Coldstream Hills Pinot Noir","Costa De Oro Pinot Noir"); @price=("45.99","135.99","79.99","24.99","24.99", "39.99","26.99","39.99","29.99","23.99", "29.99","17.99","19.99"); @combo=($skuid,$name,$price); print "Content-type:text/html\n\n"; $n==0; foreach $item(@combo) { print "SKUID:$skuid[$n]\n"; print "NAME:$name[$n]\n"; print "PRICE:$price[$n]\n"; $n++; }
That said, I'm not entirely sure of your goal here. I'm going to guess that you want to print out the three data points for each wine. As chromatic suggested, you probably want a better data structure. May I suggest a hash? Since the skuid is probably unique, I would make that the key. Each value would then be an array containing the vinyard and the price. Then you just dump the contents of the hash. (crudely using data::dumper, or nicely as I do below.) Here is my version:
#!/usr/bin/perl use strict; # Always. use CGI ':standard'; my %winelist = ( "11021" => ["mt. eden", "45.99"], "11022" => ["dom perignon", "135.99"], "11023" => ["veuve cliquot", "79.99"], "92523002" => ["Arcadian Pinot Noir Sl Holl", "24.99"], "02196005" => ["Au Bon Climat Pinot Noir La Bauge", "24.99"], "92196019" => ["Au Bon Climat Pinot Noir Laetitia", "39.99"], "92176184" => ["Bannister Pinot Noir Seghesio Vineyard", "26.99"], "92305069" => ["Broadley Pinot Noir Claudias Choice", "39.99"], "92305070" => ["Broadley Pinot Noir Marcille Loraine", "29.99"], "92305054" => ["Broadley Pinot Noir Reserve", "23.99"], "14316002" => ["Castalia Pinot Noir Rochioli Vyd", "29.99"], "92620206" => ["Coldstream Hills Pinot Noir", "17.99"], "92503001" => ["Costa De Oro Pinot Noir", "19.99"], ); print header(), start_html(); print "\n\n<!-- This page generated by a script written by Adam at Per +lMonks.org -->\n\n"; print h1( "My Wine Collection" ), "\n\n"; print table( {-width, '100%'}, TR( td( {-width, '20%'}, "SKUID" ), td( {-width, '60%'}, "WINE" ), td( {-width, '20%'}, "PRICE" ) )), "\n"; my $wine; foreach $wine (keys %winelist) { print table( {-width, '100%'}, TR( td( {-width, '20%' }, "$wine" ),"\n", td( {-width, '60%' }, "$winelist{$wine}[0]" ), td( {-width, '20%' }, "$winelist{$wine}[1]" ) )), "\n"; } print end_html();
Note that I assumed from your print content text/html line that this was generating html, so I did it using CGI.pm's procedural methods. You can also use CGI.pm oo methods, but I didn't feel like it.

In reply to RE: Perplexed Winemaking Monk by Adam
in thread Perplexed Winemaking Monk by bini

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.