http://www.perlmonks.org?node_id=1008415


in reply to reversed hash doesn't identify keys

holly71:

If you want to reverse the letter order in a word, you can do that by splitting the word into characters (via split), and then rejoin them in the correct order:

# Take a word my $word = "Constantinople"; # Split into letters: my @letters = split '', $word; # Reverse them my @srettel = reverse @letters; # Join back into a single word: my $drow = join('', @srettel);

Of course, you can combine it all into a single step:

my $drow = join('', reverse split //, "Constantinople");

Update: Or you could (as johngg pointed out) just use reverse, and it'll do the job without all the hoop-jumping-through-stuff.

...roboticus

When your only tool is a hammer, all problems look like your thumb.