Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973803]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-02-20 02:07 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (293 votes). Check out past polls.