#!/usr/bin/perl use Win32::Console; use strict; open(STDERR, ">error.log"); my $con = Win32::Console->new(); $con->Mode(ENABLE_WINDOW_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); $con->Display; $con->Write("Please enter the agent ID number: "); chomp(my $port = ); $con->Write("The port number to use is $port.\n"); #Debug stuff, this works open(CONFIG, "+<", "c:\\blah.txt" or die "Can't open blah.txt: $!"); my @configfile = ; foreach my $configfile (@configfile) { $configfile =~ s/serverport 111$/serverport $port\n/; print CONFIG $configfile; } close(CONFIG); close(STDERR);