Dr. Mu has asked for the wisdom of the Perl Monks concerning the following question:
It seemed like a reasonable thing to do. But apparently I had never tried it or had simply forgotten that, "The undef function is a unary operator, not a list operator, so you can only undefine one thing at a time." (Camel Book) So, I settled for the less elegant (in my mind),undef ($from, $to) if $from > $to
But I got to thinking, what would have been so bad about allowing undef to undefine a list of variables? I'm hard-pressed to think of any inconsistencies or ambiguities that might crop up if such a construct were allowed. After all, my can declare a list of variables. It seems logical that if you wanted to wipe that same list clean later, a parallel construction would be a clear and handy thing to have.$from = $to = undef if $from > $to
So, any ideas why this limitation exists in Perl?
20050201 Considered: holli: move to meditations, unconsidered by Corion: 13/19/0 - no decision
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: undef a List of Variables
by borisz (Canon) on Jan 31, 2005 at 10:15 UTC | |
|
Re: undef a List of Variables
by Anonymous Monk on Jan 31, 2005 at 11:07 UTC | |
|
Re: undef a List of Variables
by ambrus (Abbot) on Jan 31, 2005 at 10:42 UTC | |
by dragonchild (Archbishop) on Jan 31, 2005 at 17:31 UTC | |
by ambrus (Abbot) on Jan 31, 2005 at 18:54 UTC | |
by lidden (Curate) on Jan 31, 2005 at 18:01 UTC | |
|
Re: undef a List of Variables
by holli (Abbot) on Jan 31, 2005 at 10:04 UTC | |
by Aristotle (Chancellor) on Jan 31, 2005 at 10:17 UTC | |
|
Re: undef a List of Variables
by sh1tn (Priest) on Jan 31, 2005 at 11:23 UTC |