Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL reverse Function
Syntax
Definition and Usage
In a list context, returns the elements of LIST in reverse order. In a scalar context, returns a concatenated string of the values of LIST, with all bytes in opposite order.
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
@array = (2,3,4,5,6,7);
print "Reversed Value is ", reverse(@array), "\n";
$string = "Hello World";
print "Reversed Value is ", scalar reverse("$string"), "\n";
|
It will produce following results:
Reversed Value is 765432
Reversed Value is dlroW olleH
| |
|

|
|
|