$|=1; # So it works in the Open Perl IDE

@arr = qw /fred barney wilma betty/;
# reverse the strings that are compared. That way the comparing will effectively
# start in the back and go to the front of the string
@sorted = sort {(reverse $a) cmp (reverse $b)} @arr;
print "@sorted";
