Cody:

Seems that I should not ask questions after midnight!

Some points:

  • I can split the two scalars, thats isn't a problem :)
  • The options need not appear on the form, they can be hidden fields.
  • I would ideally like to be able to refer to them like this: $value = $options{option#}{scalar1 or scalar2}

    Here is what is happening, we have been using a hosted shopping cart for some years, we can no longer use it because they do not support our new payment processor. Because we have a huge base of statically coded HTML pages, going back to 1996, built on this cart I need to emulate its operation. In a simple example this is what I get from the form:

    item : p-1723^I-0100^Internet book^op1op3op5^1^^^^^^ op1 : Single copy - $69.95 op3 : Hard cover - $10.00 op5 : Signed - $10.00
    Now, the right hand portion of the option, if present, in the case of options1, 3 & 5 will be added to produce the final price. In this example the total price is op1+op2+op3 or $89.95.

    The left portion, the text part, will be appended to the description. However, here comes my twist, according the documentation for the original script, op2 and op4 if returned from the form needs to be interpolated inthe description, it could be like this:

    op2 : <br>Cover: op4 : <br>
    So that when the description is displayed it will look like:
    Single copy Cover: Hard cover Signed
    In a single cell in a table.

    My question is this. How would you, or the other monks, suggest I create the hash I would like to use. Or even better, should I be using a hash like that at all?

    Your respectful Perl novice,

    John


    In reply to Re: Re: CGI - Parsing many options. by jdtoronto
    in thread CGI - Parsing many options. by jdtoronto

    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.