in reply to using multiple input files

I am attempting to write a script using two input files.

(Voice from above with echo) You have succeeded my son.

Would the below code to it for me

(Voice from above with echo) What are you trying to achieve? A little explanation about the desired functionality could be helpful.

More seriously: you don't do any error checking, what if one of the issued commands fails? You could put use strict; use warnings; in your script.

Update
You don't close the file handles.
And, hint:
Name "main::HDCLGET" used only once: possible typo

Replies are listed 'Best First'.
Re^2: using multiple input files
by ddrew78 (Beadle) on Mar 31, 2009 at 15:53 UTC
    it appears I almost succeeded. I have already changed the code to the below, but it still doesn't quite process it the way I want. Here is what I have for the code:
    print HDLCGET "\#\!\/usr\/local\/bin\/expect\n"; print HDLCGET "set timeout -1\n"; open(MYINPUTFILE, "hdlc2"); open(MYINPUTFILE1, "hdlc3"); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); while(<MYINPUTFILE1>) { my($line1) = $_; chomp($line1); print HDLCGET "spawn \ ssh $line\n"; print HDLCGET "expect \"assword: \"\n"; print HDLCGET "send \"$tacacspw\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"terminal length 0\\r\"\n"; print HDLCGET "expect \"#\"\n"; print HDLCGET "send \"show xconnect all | inc $line1\\r\"\nexp +ect \"#\"\n"; print HDLCGET "send \"exit\\r\"\n"; print HDLCGET "interact\n"; } } close(MYINPUTFILE); close(MYINPUTFILE1);
    Now, the problem: while it does properly process the second input file (hdlc3), it won't move to to the second line of the first input file (hdlc2). Basically, what I'm trying to do is to have it do is process line of of file 1 and 2, then line two of file 1 and 2, etc. Any ideas?