On Thu, Oct 23, 2014 at 2:57 PM, Father Chrysostomos wrote:
Several times in the past I have wished I could write:

($foo, (undef)x3, $bar) = that_function();
I can see how this is useful for functions like localtime() and
stat(), but it really is just an alternate form for a list slice:

($foo, $bar) = (that_function()) [0, 4];

I don't find the "undef repetition" form easier to read, so I would
consider it redundant syntactic sugar (not that there is anything
wrong with that, this being Perl and all...).
But x is not allowed as an lvalue. Is there any reason not to make
this work for the specific case of list repetition in list assignment?
I see this as being of rather limited use, so if it makes the code
significantly more complicated, I don't think it would be worth it.
But otherwise I can't think of any objections.

Also, would this allow arbitrary repetition?

($foo, (undef) x $count, $bar) = that_other_function();


Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 5 | next ›
Discussion Overview
groupperl5-porters @
postedOct 23, '14 at 9:57p
activeOct 24, '14 at 7:41p



site design / logo © 2019 Grokbase