That is exactly what I was looking for. Thanks! Could I ask you for another favour, since I am not a programmer? The file that I need to parse holds multiple lines with a record-id followed by 4 spaces followed by the string with inventorynumbers. For example: 123 ph1-3;25;t3 234 45;67-69 345 t200 What I need to end up with is a file that looks like this: 123 ph1 123 ph2 123 ph3 123 25 123 t3 234 45 234 67 234 68 234 69 345 t200 So, I would like to know is how to write a Perl script that reads a file line by line, breaks down each line in record-id followed by inventorynumber for each inventory number in the range given for that record-id and does that for each record-id. I take it that I have to use an array for that, and voila, I am already out of my depth. If you think I am too cheeky, just say so. Eventually I will figure out how to read the contents of a file and how to use arrays. It is just that I amm pressed for time. I would never have figured out how to use Perl to break-down ranges though : )

In reply to Re^2: break-down ranges by goorgi01
in thread break-down ranges by Anonymous Monk

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.