Hey guys I am new to perl and I am developing a CGI script which takes input from the user and assign it to the hash reference $ input...I am generating all the dates in between the range given by the user and storing it in the array...For each date stired in @date I wants to assign the value of array to the hash reference ...following is the code which I am using.....kindly let me know how to access every element of the array using foreach loop . Another Question is can I assign the user input through param in foreach loop...

foreach (@date){ # create hash reference variable for user inputs as well as every date + in array @date $user_input->{pp_branch} = param('pp_branch'); $user_input->{host_name} = param('host_name'); $user_input->{controller} = param('controller'); $user_input->{start_date} = ;#I wann assign here each element of array + unless the array gets empty; # .... some code.......... }

The doubts are silly ....but I am confused.....so wants to confirmed @ it ...After all PerlMonks is the place where we can get faithful information:-)

Thanks in advance !!!!


In reply to Questionon foreach loop syntax by siddheshsawant

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.