What I am trying to do is create a file when the user enters "C" as their answer. Then when it creates the file it will start the file heading with "Global" and all the user to then enter the ip address of their TFTP server. The script should then write their tftp server ip address to the file, close the file and then exit. However, what I have doesn't make anything in the if loop run. I enter "C" as my choice and then it just dies. I would appreciate any help you can offer.#!/usr/bin/perl -w use strict; # Modules to use use Config::IniFiles; # Variables my ($CorE, $PlugInDir, $LogFile, $ForkLimit, $TftpRoot, $TftpPath, $Fi +leStyle, $DateStyle, $PreCmd, $PostCmd, $SNMPver, $SNMPretry, $SNMPwait, $SNMPm +tu, $SNMPdebug, $SNMPCommunity, $TFTPserver); # Start print 'Would you like to edit the current pancho configuration file or Create a new file [e/C]? ';$CorE=<STDIN>; # Create new file if ($CorE eq 'C') { open (CREATE,">>pancho.conf"); print CREATE "[Global]"; print 'What is the IP address of your TFTP server? '; $TFTPserver=<STDIN>; print CREATE $TFTPserver; close (CREATE); }
In reply to Trying to Create and Write to a file by IPstacks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |