Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: passing a value to a function

by ishmael (Novice)
on Jun 26, 2001 at 13:09 UTC ( #91535=note: print w/replies, xml ) Need Help??


in reply to passing a value to a function

ishmael
$array = [ ] ;

is sufficient. This will effectively "clear" the array. Depending on your requirements, $i=[ 0 ] , $i=undef ], and $i may be all equivalent.

Remember that undef is actually an array element. I have caught myself thinking that @array = (undef) is an empty array. Nope. It is a single-element array with the element undef!

Replies are listed 'Best First'.
Re: Re: passing a value to a function
by busunsl (Vicar) on Jun 26, 2001 at 14:33 UTC
    $array = [ ] ;
    is sufficient. This will effectively "clear" the array.

    Nope, it will not clear the array!
    Instead it will create a new, empty anonymous array and store a reference to that in $array.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://91535]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-09-26 16:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?