On Monday 14 January 2002 04:54 pm, you wrote:
> Can I use this :-
> @my_arry = undef;
No, because it doesn't clear the array. Read the following quote:
Small quote from "Learning Perl" page 53 - under the section "Using
Scalar-Producing Expressions in a List Context"
<<begin quote>>
Going this direction is straightforward: if an expression doesn't normally
have a list value, the scalar value is automatically promoted to make a
one-element list:
@fred = 6 * 7; # gets the one-element list (42)
@barney = "hello" . ' ' . "world";
Well, there's one possible catch:
@wilma = undef; # OOPS! Gets the one-element list (undef)
# which is not the same as this:
@betty = (); # A correct way to empty an array
Since undef is a scalar value, assigning undef to an array doesn't clear the
array. The better way to do this is to assign an empty list
<<end quote>>
Steven
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]