Ok, since you've said that the user input needs to happen repeatedly, that tells you that you want the user input to happen inside a loop. Since you've said that you want to keep looping *while* a certain condition isn't met (the user says 'no'), that tells you that you want a while loop.

Personally I like to use psuedo-code - something that is half-way between English (or whatever your native tongue) and code - and then gradually replace the pseudo-code with real code. Here's how I'd start with your assignment:

    user_wants_to_continue is 'yes'
    while ( user_wants_to_continue is not 'no' ) {
        prompt for and get product_name
        prompt for and get quantity
        prompt for and get price
        store product_name in array
        store product_name, quantity, price in hash
        prompt for and get user_wants_to_continue
     }

In reply to Re^3: seeking advice on loops by jZed
in thread seeking advice on loops by sierrastar

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.