First, instead of repeately using shift, you might just want to use a foreach or maybe even a for:
foreach my $line (@netlist) { # ... }
For those cases where you want to skip ahead a line, you can do something like this:
for (my $i = 0; $i < @netlist; $i++) { my $line = $netlist[$i]; if ($yadda_yadda) { $line = $netlist[++$i]; # ... } }
Keep in mind that =~, and !~ are string comparisons using regular expressions. This is different from the regular string comparators 'eq' and 'ne' in that they check for matches, not equivalence.

As for what you mean by for ($line), you probably want to pass it an array or a list rather than a single element.

IMHO, I don't think you're approaching this correctly. Think first, code second. You seem to be doing the reverse. You will probably have better results if you can think your problem through completely in terms of functionality and then translate these thoughts into Perl.

In reply to Re: Search and replace.. ..a bit different by tadman
in thread Search and replace.. ..a bit different by Rhodium

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.