THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.
This tutorial shows you how to reverse a string and list in Perl.
Perl reverse function does two things
reverse function reverse variable data. Syntax
reverse(variable);
Reverse the data in the variable and returns it
Here is an example
my $str="Hello";
$reverseStr = reverse($str);
print "$reverseStr";
Output:
olleH
To reverse the array in reverse order, Please follow the steps.
my @number=(1,2,3,4,5);
@reversenumbers = reverse(@number);
print "@reversenumbers";
Output:
5 4 3 2 1
To reverse String in reverse order, Please follow the steps.
my $name="welcome";
$reverseName = reverse($name);
print "$reverseName";
Output:
emoclew
🧮 Tags
Recent posts
Julia examples - Variable Type Nim example - Convert String to/from the Int How to get length of an array and sequence in Nim? Nim environment variables - read, set, delete, exists, and iterate examples? How to convert from single character to/from string in Nim?Related posts