This is the text file i have. if it contains alphabets,perl should create a file name else it should login to the device with the given ip address in the file.network1 12.435.23.12 12.45.34.23 network2 32.334.23.23 54.56.563.32
can anyone give suggestions on this ?#/usr/bin/perl use Net::Telnet; use Net::Telnet::Cisco; #Opening a input text file for logging into devices open inFile, '<', 'ip.txt' or die "MESSAGE From SAT : Couldn't open ip +ut.txt for reading verify the correct path : $!"; print " hello \n\n "; #storing the contents of the input file to a variable print " Reading the file . . .\n\n"; while (! eof inFile) { $line .= ' ' . <inFile>; chomp $line; print $line,"\n\n"; if ($line=/.*?\w/) { $accountname = $1; print "Account name =", $accountname; open ("$accountname"), or die "Could not create the account name.txt.\ +n"; ................ . . } }
In reply to text parsing by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |