I have a text file where each new record starts on a new line and for each record the fields are tab delimited. The text file looks something like:
ID1\t NAME1\t AGE1\t LOCATION1 \n<br> ID2\t NAME2\t AGE2\t LOCATION2 \n<br> ID3\t NAME3\t AGE3\t LOCATION3 ... and so on
Further I know that the ID field will take 10 spaces, the NAME field will take 15 spaces, AGE field will take 2 spaces and LOCATION field will take 20 spaces.

I want my Perl script to read this text file and store each record in an array. That means it should store ID1, NAME1, AGE1 and LOCATION1 in array1 and ID2, NAME2, AGE2 and LOCATION2 in array2, and so on...
Can someone help me to write this script?

In reply to Perl script to read from a text file by shilpam

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.