in reply to Script to telnet to different cisco devices, but timed out at a particular statement.
You need more subroutines, subroutines that don't work on global variables , but subroutines that take arguments, return values, die on error
When you write a bunch of times (like 3)
open $logfile3... foreach(@output3)... print $logfile3... close $logfile3;
You need to turn that into a subroutine ... or use Path::Tiny
use Path::Tiny qw/ path /; path( $logfile1 )->spew( @output1 ); path( $logfile2 )->spew( @output2 ); path( $logfile3 )->spew( @output3 );
|
|---|