Reverse a list of numbers stored in a variable
In Perl, let's say ,there is a variable:$j = "12,11,10,9";If we want to reverse the string list based on the "," and get the output like:
9,10,11,12Below is the logic to achieve the same:
print join "," ,reverse split /,/, $j
0 comments: