Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Thank you, that solved a large part of my problem. The only issue remaining now is that in files 'host' and 'host1', it only inserts the first line from file3 and leaves it out for subsequent lines.

The output currently looks like this for 'host':
SR-IT-SD4546-IBV-sw947-A SR-IT-SD4546-IBV-sw908-A SR-IT-SD4748-IBV-sw-A SR-IT-SD4748-IBV-sw-A
and like this for 'host1':
SR-IT-SD4546-IBV-sw947-B SR-IT-SD4546-IBV-sw908-B SR-IT-SD4748-IBV-sw-B SR-IT-SD4748-IBV-sw-B
The code has been modified to look like this:
open(MYINPUTFILE, "file1"); open(MYINPUTFILE1, "file2"); open(MYINPUTFILE2, "file3"); open(HOST, ">host"); open(HOST1, ">host1"); while (<MYINPUTFILE>) { my($line) = $_; chomp($line); for ($numsw = $swnum; $numsw > 0 ; $numsw-- ){ my $line1 = <MYINPUTFILE1>; chomp($line1); my $line2 = <MYINPUTFILE2>; chomp($line2); print HOST "SR-$line1-SD$line-IBV-sw$line2-A\n"; print HOST1 "SR-$line1-SD$line-IBV-sw$line2-B\n"; open (OUTHANDLE, ">>$line2"); print OUTHANDLE "SR-$line1-SD$line-IBV-sw$line2-A\n"; print OUTHANDLE "SR-$line1-SD$line-IBV-sw$line2-B\n"; close (OUTHANDLE); seek (partner,0,1); seek (switchid,0,1); } } close (MYINPUTFILE); close (MYINPUTFILE1); close (MYINPUTFILE2); close (HOST); close (HOST1);

This is the last issue I have to solve before being able to use this for production work, so any additional help is greatly appreciated.


In reply to Re^2: running multiple loops by ddrew78
in thread running multiple loops by ddrew78

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (6)
    As of 2014-04-17 02:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (437 votes), past polls