in reply to quick sort. How do it faster
my (@out,$ref) = undef;
My guess as to the intent of this statement from the OPed code is that it was to be some kind of self-documentation of the creation of two lexical variables: an empty array and an undefined scalar. It does not do what I think you think it does.
In fact, it is equvalent to the
my (@out, $ref) = (undef);
statement, which uses the list (undef) to initialize the newly-created lexicals. However, due to list flattening, the @out array 'consumes' all the elements of the initialization list, thus producing a non-empty array with a single element: undef. In view of the push @out, ...; statement in the subsequent for-loop, it seems unlikely this behavior was intended. (But the $ref scalar remains undefined after all this!)
>perl -wMstrict -MData::Dump -le "my (@out,$ref) = undef; dd \@out; " [undef]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^: quick sort. How do it faster
by builat (Monk) on Oct 21, 2013 at 00:35 UTC |