Two ways to undef? 
Author Message
 Two ways to undef?

Since undef is both a function and a value, are the following equivalent?

undef $scalar;
$scalar = undef;

I suppose the answer is more complicated for arrays.
--
Danny Faught, Convex rookie
"Using a computer should always be easier than not using a computer."
                                                                - Ted Nelson



Sun, 10 Sep 1995 07:46:45 GMT  
 Two ways to undef?

: Since undef is both a function and a value, are the following equivalent?
:
: undef $scalar;
: $scalar = undef;

They're equivalent, though undef is always a function, even when it has
no argument.  It's better to think of it this way so that you'll
remember to put undef() when there's any ambiguity about whether there
IS an argument.

: I suppose the answer is more complicated for arrays.

Yes, because undef is a scalar, and when say


You get an array with one (undefined) scalar value in it.

Larry



Wed, 13 Sep 1995 04:00:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Different ways of initialising a two dimensional array

2. select($rout,undef,undef,undef) not working (always returns)

3. select( undef, undef, undef, 1.5) under WinNT

4. How to map (undef,undef) to (), but (undef,$y) to (undef,$y)?

5. undef($foo) versus $foo = undef()?

6. undef ($var) the same as $var = undef ?

7. Comparison of two fields in two text files

8. passing two arrays two a sub

9. Combining two files into a two-column file

10. Seeking advice on semantics (pros / cons and best ways of) using constants across modules

11. fast ways to count substrings

12. Ways to test for membership?

 

 
Powered by phpBB® Forum Software