Tech Journal Back to Tech Journal

Perl list-context assignment to undef

In list context where the lvalue is a list, setting one of the values to be assigned to undef will just get rid of it. For example, in:

($a, $b, undef, $c) = split(...)

the undef will cause the 3rd value returned from split not to be assigned to anything, and basically ignored.

Last updated on 2005-07-21 14:00:00 -0700, by Shalom Craimer

Back to Tech Journal