$ perl -e ' $x = "abcdefghi"; print +($x =~ /./g)[-$_] for (1 .. $#{[$x =~ /./g]} + 1); ' ihgfedcba