Mathew Snyder wrote:
> Code snippet at the end of my little script:
>
> <more code>
> ...
> my $count;
> foreach my $email (@emails){
> print $email, "\n";
> $count += 1;
> };
>
> if ($count > 0){
> print "\n" . "count = " . $count . "\n";
> }
> else{
> print "count = 0";
> };
> exit;
>
> I've declared $count globally so I can use it in more than one block of code.
> However, when I execute this I get an error saying "Use of uninitialized value
> in numeric gt (>) at ./check_spam_users.pl line 59." Line 59 being the if
> ($count > 0) line.
Change:
my $count;
To:
my $count = 0;
And you won't get that warning message.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>