Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
There's more than one way to do things
 
PerlMonks  

Re: Re: Clearing Array Values

by Anonymous Monk
on Feb 09, 2002 at 01:22 UTC ( [id://144324]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Clearing Array Values
in thread Clearing Array Values

Yeah, knew that on the @ and $ thing there, used the @ so the writing was clearer.. I tested out your two thing and came up with a parallel <sp? its late> problem.

$array =(); print $#array, "\n"; results in -1 as it should be since the array has no values any longer and is a cleared array.

$array = undef; print $#array, "\n"; results in 0; which is not a cleared array, its an array with one value, and in this programs case would have resulted in the same bug, since the looping would have then started at the $array1 value instead of $array[0] value.

Ah. the things I think are important on a Friday night.

Anyway, thanks for the comments, always more than one way to do a thing.

webadept

Replies are listed 'Best First'.
Re: Re: Re: Clearing Array Values
by rchiav (Deacon) on Feb 09, 2002 at 02:17 UTC
    undef @array and @array = undef are not the same thing.
Re: Re: Re: Clearing Array Values
by rdfield (Priest) on Feb 09, 2002 at 04:24 UTC
    Yeah, knew that on the @ and $ thing there, used the @ so the writing was clearer.. I tested out your two thing and came up with a parallel problem.

    so, who doesn't use warnings then? :)

    rdfield

Re: Re: Re: Clearing Array Values
by wog (Curate) on Feb 09, 2002 at 09:31 UTC
    You seem to be confused. I did not mean that $array should be used instead of @array. @array is definately correct if you are not selecting an indiviual element...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://144324]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.