Perl array reverse() function - Quick Tutorial

How to use the array reverse() function

 @REVERSED_LIST = reverse(@ARRAY); 
Perl's reverse() function is used to reverse the order of an array. It should be noted that the function returns a reversed array but does not actually reverse the array passed into the function.
 @myNames = ('Jacob', 'Michael', 'Ethan', 'Andrew');
 @reversedNames = reverse(@myNames); 
Think of the @myNames array as a row of numbered boxes, going from left to right, numbered starting with a zero.
The reverse() function would copy the contents of the boxes from the @myNames array into the @reversedNames array, while reversing their order. The value of @reversedNames then becomes ('Andrew', 'Ethan', 'Michael', 'Jacob'), and @myNames remains the same.
Format
mla apa chicago
Your Citation
Brown, Kirk. "Perl array reverse() function - Quick Tutorial." ThoughtCo, Nov. 25, 2014, thoughtco.com/perl-array-reverse-function-quick-tutorial-2641162. Brown, Kirk. (2014, November 25). Perl array reverse() function - Quick Tutorial. Retrieved from https://www.thoughtco.com/perl-array-reverse-function-quick-tutorial-2641162 Brown, Kirk. "Perl array reverse() function - Quick Tutorial." ThoughtCo. https://www.thoughtco.com/perl-array-reverse-function-quick-tutorial-2641162 (accessed September 23, 2017).