As well as the = instead of =~ problem that other people have already addressed, what are you doing with the values in the captures?

{ (@alternative_ids, $8)}

doesn't do anything, as far as I'm aware. You might want to be pushing (perldoc -f push) values onto that array.

Also, you have one use of @alternative_id, when all the rest are @alternative_ids. You could look into the use of use strict; to avoid this sort of typo.

edit: Another thing is that for $2, $3 etc. you already know that they match /.{0,50}/, since that's how you grabbed them from the original regex. To subsequently check them with /.{1,50}/ is (to me) a bit of overkill. You could just use either if $2 (or $2 =~ /./ if $2 is allowed to be '0')

edit:Another thing to note, and one that's very important (it just occurred to me when I was thinking of something else) is that if you have $1, $2, $3 etc, and then run another match, they will all get wiped out. So as soon as you do:

if ($2 = /.{1,50}/){ (@alternative_ids, $2)};

all your subsequent tests (and whatever you were wanting to do with $2 in that block) are to no avail. $3, $4, $5 etc. simply aren't there any more. You'll have to assign them to slightly more persistent variables beofre running any matching tests on them.

Jasper

In reply to Re: File handle problems by Jasper
in thread File handle problems by matth

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.