D
David Filmer
OK, a simple task: I want to invert (reverse) a string, such that
'ABCDEFG' becomes 'GFEDCBA'
I first thought of:
print reverse split //, $foo; # Yikes, did I write THAT?!?!?!
but realized that first thoughts are often FAR more twisted and
convoluted than they ever need to be, so I reconsidered with:
while ($foo) {
print chop $foo; #a new Chinese dish?
}
which is FAR better than my first idea, but still doesn't strike me as
truly elegant.
I wonder how other hacks might code it.
'ABCDEFG' becomes 'GFEDCBA'
I first thought of:
print reverse split //, $foo; # Yikes, did I write THAT?!?!?!
but realized that first thoughts are often FAR more twisted and
convoluted than they ever need to be, so I reconsidered with:
while ($foo) {
print chop $foo; #a new Chinese dish?
}
which is FAR better than my first idea, but still doesn't strike me as
truly elegant.
I wonder how other hacks might code it.