develooper Front page | perl.beginners | Postings from March 2002

Re: Array question...

Thread Previous
From:
Michael D. Risser
Date:
March 28, 2002 09:18
Subject:
Re: Array question...
Message ID:
200203281413.g2SEDDs04494@defiant.visionpro.com
On Thursday 28 March 2002 08:54 am, you wrote:
> OK here's the problem:
>
> I have an array that may or may not have been assigned to, if it has been
> assigned to I need to do one thing, otherwise I need to do something else.
>
> I've tried many variations, but I'm having trouble determining if it has
> been assigned to.
>
> if(undef @myArray) {
>     # Do thing1
> } elsif(!undef @myArray) {
>     # Do thing2
> }
>
> and
>
> if ($myArray[0] ne "") {
>     # thing1
> } else {
>     # thing2
> }
>
> as well as a few other variations. Printing out the array BEFORE the if
> block shows nothing in the array, yet it does thing1.

OOPS I meant it does thing2 :-)

> After trying many different methods, I am totally lost, please help me!
>
> TIA

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About