substr, length, and a C-style for loop are the most obvious tools. What have you tried so far?

You probably haven't had much exposure to the Monastery, but here are some tips:

We prefer questions that show some initiative. If you just need code written for you, you may find a paid contractor to be more receptive. If you're here to learn, that process starts with you, and we're happy to add our experience and guidance to the efforts you invest.

We can assist as you hit stumbling blocks. If the stumbling block is "I have no idea how to program or how to use Perl, but I need a solution by next week.", your situation actually isn't as desperate as you might think. Read perlintro, think of how you might solve the problem with pencil and paper, and then get started trying to implement that strategy with Perl.

When you do post questions, post the code you've got so far so that we can see where help is needed.


Dave


In reply to Re: how to access elements in perl by davido
in thread how to access elements in perl by grewal7634

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.