in reply to Simple one
One difference is about context. The first line sets @_ in scalar context, which makes Arrays give back the number of their elements.
The second line sets the Array in list context, because $root now is in a list. The fact that the list has only one element does not concern @_. In list context, Arrays return all their elements. Since the list has only one element, only the first element of the array is stored.
The second line sets the Array in list context, because $root now is in a list. The fact that the list has only one element does not concern @_. In list context, Arrays return all their elements. Since the list has only one element, only the first element of the array is stored.
|
---|
In Section
Seekers of Perl Wisdom