Simple Question from a simple chap! 
Author Message
 Simple Question from a simple chap!

Hi there guys,

Coulkd someone help me out and tell me the best way to handle the following
error:

    "Use of uninitialized value in numeric ne (!=) at
C:/apache/cgi-bin/memberRegUpload.pl line 119."

I know why its saying it but I dont know how to deal with it. Let me
explain.

I'm taking in the values for the array via a form and sometimes it'll be
empty, but this is what I want to test for - emptyness

I've been trying:


and also

if ($inputedClubs[0] != ""){ do whatever }

I just want to see if the array has been filed with anything.

I guess my question is how do you test an array for emptyness without
getting told its uninitialized!!

Any advice very greatly appreciated

Kind regards
Simon

--
**If at first you don't succeed - destroy any evidence that you tried!**



Tue, 01 Mar 2005 15:09:50 GMT  
 Simple Question from a simple chap!


Quote:
> I guess my question is how do you test an array for emptyness without
> getting told its uninitialized!!

perldoc -f defined

This should solve your problem.

Regards

Dg



Tue, 01 Mar 2005 15:20:58 GMT  
 Simple Question from a simple chap!
On Fri, 13 Sep 2002 15:09:50 +0100, "Simon Harvey"

Quote:

>I've been trying:


This would work:


definedness.

On the other hand, that's not what you want.
It should never be undefined.

What you really want is to check for content,
AKA truth.

So, without further ado [untested]

#!/usr/bin/perl -w

use warnings;
use strict;

 # Given your program path,  I presume you get this
# from a form and that this is a CGI script, so:

use CGI;
my $query = new CGI;

# And here is how you test for truth.  Simple, no?


{
        # do this

Quote:
}

else
{
        #do that
Quote:
}

--
Regards, Helgi Briem
helgi AT decode DOT is


Tue, 01 Mar 2005 15:31:19 GMT  
 Simple Question from a simple chap!

Quote:


>> I guess my question is how do you test an array for emptyness
>> without  getting told its uninitialized!!

On Fri, 13 Sep 2002 15:20:58 +0100, "David Gethings"

Quote:

>perldoc -f defined
>This should solve your problem.

No it won't.  'defined'  will test correctly for
definedness,  but that's not really what the OP
wants, although that's what he thinks he wants.

He wants to check it for emptyness, aka falseness.
--
Regards, Helgi Briem
helgi AT decode DOT is



Tue, 01 Mar 2005 15:34:17 GMT  
 Simple Question from a simple chap!


Quote:
> On Fri, 13 Sep 2002 15:20:58 +0100, "David Gethings"

> >perldoc -f defined
> >This should solve your problem.

> No it won't.  'defined'  will test correctly for
> definedness,  but that's not really what the OP
> wants, although that's what he thinks he wants.

> He wants to check it for emptyness, aka falseness.

Helgi,

I suggested that the OP read the perldoc for defined, not that he should
actually use defined.

Regards

Dg



Tue, 01 Mar 2005 15:50:26 GMT  
 Simple Question from a simple chap!

--
**If at first you don't succeed - destroy any evidence that you tried!**

Quote:
> On Fri, 13 Sep 2002 15:09:50 +0100, "Simon Harvey"

> >I've been trying:

> This would work:


> definedness.

> On the other hand, that's not what you want.
> It should never be undefined.

> What you really want is to check for content,
> AKA truth.

> So, without further ado [untested]

> #!/usr/bin/perl -w

> use warnings;
> use strict;

>  # Given your program path,  I presume you get this
> # from a form and that this is a CGI script, so:

> use CGI;
> my $query = new CGI;

> # And here is how you test for truth.  Simple, no?


> {
> # do this
> }
> else
> {
> #do that
> }
> --
> Regards, Helgi Briem
> helgi AT decode DOT is

Thank you kind ladies and gentlemen.

I have some playing to do I think

Many thanks for your advice

Kind Regards

Simon



Tue, 01 Mar 2005 18:25:27 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. XS - Simple answer to simple question?

2. Simple Question - LWP::Simple not accessing the internet

3. simple, simple question

4. Simple Unix Question, ( Simple for you maybe )

5. Simple simple question

6. Simple TCP client using io::socket::inet not so simple

7. A simple problem befuddling my simple head

8. simple, simple regex Q

9. Help with simple simple perl script...

10. Graphics::Simple 0.03 - C-64-like simple drawing

11. simple, simple LABEL Q

12. simple reference question

 

 
Powered by phpBB® Forum Software