Perlmonks is a place where other Perl users, on a strictly voluntary basis, help one another solve problems. Instead of posting code and asking us if it's right, post code *and the results of running it*, and ask us to resolve the differences between what you thought it would do and what it did. There's almost no reason to post code without running it first. Monks may be wrong about what it will do when executed, but the compiler won't. You should ask the compiler what your code does (by running it).

As for your code, it's not at all clear what you're trying to accomplish, but as it stands, you're doing scalar assignment to the same variables on each pass through the loop, as near as I can tell, so everything's going to get clobbered. That doesn't seem like what you want, but I could be wrong.


In reply to Re: Questionon foreach loop syntax by ssandv
in thread 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.