Just another Perl shrine | |
PerlMonks |
Re: pop and shift not reversibleby BillKSmith (Monsignor) |
on Mar 20, 2020 at 14:42 UTC ( [id://11114523]=note: print w/replies, xml ) | Need Help?? |
The solutions Re: pop and shift not reversible proposed by hippo and Re: pop and shift not reversible ( while @array ) proposed by Anonymous Monk are not the same if the data array contains undefined elements. The later probably better answers the question in your title because it does not depend on the contents of the array, only its size. On the other hand, the former is often preferred precisely because it does not return undefined data at the end of the array.
Bill
In Section
Seekers of Perl Wisdom
|
|