reverse() function in
Perl when used in a list context, changes the order of the elements in the List and returns the List in reverse order. While in a scalar context, returns a concatenated string of the values of the List, with each character of the string in the opposite order.
Syntax: reverse List
Returns:
String in Scalar Context and List in List Context.
Example 1: In List Context:
Output:
706050403020
6-543-21
Example 2: In Scalar Context:
Output:
dlroW olleH
skeeG roF skeeG