Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: running multiple loops

by ddrew78 (Sexton)
on Jun 01, 2012 at 15:38 UTC ( #973803=note: print w/ replies, xml ) Need Help??


in reply to Re: running multiple loops
in thread running multiple loops

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.


Comment on Re^2: running multiple loops
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-12-28 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls