John Serink wrote:
> Hi All:
>
> I'm using strict and use warnings in my script and I read in a
> configuration file. I think parse it and I want to load some names and
> phone numbers into a hash like this:
> my %ToSend=('party',000);
> for(my $i=0;$i<scalar(@config);$i++){
> if($numberlist == 1){
# below line should probably be an if to avoid undefs: if ($config[$i] =~
m/=/) {
> $config[$i]=~m/=/;
> $ToSend{$`}=$'; # line 35
> chomp($ToSend{$`}); # Line 36
> }
> if($config[$i]=~m/SERVER=/){
> $host=$';
> chomp($host);
> } elsif ($config[$i]=~m/PASSWORD=/){
> $smspassword=$';
> chomp($smspassword);
> } elsif ($config[$i]=~m/NUMBER LIST/){
> $numberlist=1;
> }
> }
> my @thekeys = keys(%ToSend);
> print(@thekeys);
> print("\n");
> for(my $i=0;$i<scalar(@thekeys);$i++){
> print("$thekeys[$i] with cell number:$ToSend{$thekeys[$i]}\n");
> # line 52
> }
Yet another incomplete snippet posted. Please post a snippet that
has everything defined and compiles with no errors (unless it's a
compilation error you're trying to fix).
> This all works except I get these warnings:
> Use of uninitialized value in hash element at smstest_13.pl line 35,
> <GEN0> line 7.
> Use of uninitialized value in hash element at smstest_13.pl line 36,
> <GEN0> line 7.
> Use of uninitialized value in scalar chomp at smstest_13.pl line 36,
> <GEN0> line 7.
> LimWan KamelAngparty
> Use of uninitialized value in concatenation (.) or string at
> smstest_13.pl line 52, <GEN0>
> line 7.
>
> Anybody know why I'm getting these warnings? The script all works and
> does the stuff I want it to but would like to get rid of the warnings.
I made a modified *COMPLETE* snippet and it has no errors:
use strict;
use warnings;
my %ToSend = ('party', 000);
my @config; # had to define (needs some content)
my $numberlist = 1; # had to define
my $host; # had to define
my $smspassword; # had to define
for (my $i = 0; $i < @config; $i++) {
if ($numberlist == 1) {
if ($config[$i] =~ m/=/) {
$ToSend{$`} = $'; # line 35
chomp $ToSend{$`}; # line 36
} # else do what ???
}
if ($config[$i] =~ m/SERVER=/) {
$host = $';
chomp $host;
} elsif ($config[$i] =~ m/PASSWORD=/) {
$smspassword = $';
chomp $smspassword;
} elsif ($config[$i] =~ m/NUMBER LIST/) {
$numberlist = 1;
}
}
my @thekeys = keys %ToSend;
print "thekeys='@thekeys'\n";
for (my $i = 0; $i < @thekeys; $i++) {
print "$thekeys[$i] with cell number: $ToSend{$thekeys[$i]}\n"; # L 52
}
__END__
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs