I wanted to start out by saying thanks to all who have helped me in the
past...
I am having difficulty with the uninitialized value errors...

I tested the following on its own:

#! d:\perl\bin -w

###########################################################################
#
# Author: Craig Monroe
# Name: Test script for parsing the Cayman ouput for it's IP.
# Date: 7/9/2001
#
#
#
###########################################################################
use strict;
use IO::Socket;
use IO::File;

my ($remote, $ipaddress, $line, $space);
my $cayman = "143.137.159.254";
my $interface = "123.123.123.123";
my @inter;
my @addr;

# Open a connection to the cayman

$remote = new IO::Socket::INET(PeerAddr=>$cayman,
     PeerPort=>23,
     Proto=>"tcp",
     Type=>SOCK_STREAM)
     or die "Couldn't connect to IP address $cayman\nSystem error: $!";

# set buffering off
$remote->autoflush(1);

print "\nConnecting to the Cayman at $cayman ....\n\n";
sleep('3');
print $remote "show ip int\n";
print $remote "quit\n";
print "\nParsing the output to grab the WAN IP address....\n\n";
sleep('3');

while (defined ($line = <$remote>)) {
 $line = substr("$line",1);
 # remove leading spaces if followed by 'inet'
 if ($line =~ /^  inet/){
 $line =~ s/^\s+//;

 my ($interface, $ipaddress) = split(/\s+/,$line,3);
 push @inter, $interface;
 push @addr, $ipaddress;
 }
}
print $addr[1];


----------------------------------------------------------------------------
-----------------------------------------

This works fine for me.
When I added this to my "larger" script, I keep getting errors...
"Use of uninitialized value in print at dns_lwp-mail.pl line 84, <GEN0> line
17."

#! c:\perl\bin -w

############################################################
#
# Author: Craig Monroe
# Date: July 6, 2001
# Abstract: Wrote this utility to automatically update
#   my dnsalias record. Will add mail confirmation later.
#
#

use Mail::Sendmail;
use IO::Socket;
use IO::File;
use strict;

my $remote;
my $ipaddress;
my $cayman = "143.137.159.254";
my $interface = "123.123.123.123";
my @inter;
my @addr;
my $ua;
my $req;
my $res;
my $line;
my $time;
my $dayname;
my $month;
my $day;
my $clocktime;
my $year;
my $count;
my %mail;
my $value;

$count = "0";
#system('cls'); commenting out screen clears for now to get errors

# infinite loop
{

#Get the day and if it matches the criteria, run the program

$time = scalar(localtime);
($dayname, $month, $day, $clocktime, $year) = split (/\s+/, $time);
&Title;
if ((($day eq "10") && ($count == 0)) || (($day eq "25") && ($count == 0)))
{

# Open a connection to the cayman

$remote = new IO::Socket::INET(PeerAddr=>$cayman,
     PeerPort=>23,
     Proto=>"tcp",
     Type=>SOCK_STREAM)
     or die "Couldn't connect to IP address $cayman\nSystem error: $!";

# set buffering off
$remote->autoflush(1);

print $remote "xxxxx\n";
sleep('3');
print $remote "xxxxx\n";
sleep('3');
print "\nConnecting to the Cayman at $cayman ....\n\n";
sleep('3');
print $remote "show dhcp client\n";
print $remote "quit\n";
print "\nParsing the output to grab the WAN IP address....\n\n";
sleep('3');

while (defined ($line = <$remote>)) {
 $line = substr("$line",1);
 # remove leading spaces if followed by 'inet'
 if ($line =~ /^  inet/){
 $line =~ s/^\s+//;

 my ($interface, $ipaddress) = split(/\s+/,$line,3);
 push @inter, $interface;
 push @addr, $ipaddress;
 $value = $addr[1];
 }
}
print $value;
sleep('3');
close ($remote);

<snip>

Can anyone direct me to the appropriate subject?
I read the section on my in pperl, but I couldn't seem to find
the answer.

Thank you for any direction.....


Craig
[EMAIL PROTECTED]
Pager
Numeric: 1-877-895-3558
Email pager: [EMAIL PROTECTED]
--------------------------------------------------------------
You will never find time for anything.
If you want time, you must make it.

Charles Buxton


Reply via email to