IPstacks has asked for the wisdom of the Perl Monks concerning the following question:
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); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to Create and Write to a file
by c (Hermit) on Apr 07, 2003 at 16:45 UTC | |
by IPstacks (Novice) on Apr 07, 2003 at 16:48 UTC | |
by Nkuvu (Priest) on Apr 07, 2003 at 19:21 UTC | |
|
Re: Trying to Create and Write to a file
by Improv (Pilgrim) on Apr 07, 2003 at 16:51 UTC | |
|
Re: Trying to Create and Write to a file
by Coplan (Pilgrim) on Apr 07, 2003 at 17:16 UTC | |
|
Re: Trying to Create and Write to a file
by Juerd (Abbot) on Apr 07, 2003 at 16:48 UTC | |
by Nkuvu (Priest) on Apr 07, 2003 at 19:07 UTC | |
by Juerd (Abbot) on Apr 07, 2003 at 19:18 UTC |