in reply to Re: Re: Re: Re: (Golf) Reversal
in thread (Golf) Reversal
All you need to do to solve the original problem is do a reverse
on the array in *scalar context*. Because in scalar context,
reverse concatenates its arguments, then reverses that new
strong. For example, this would solve the original problem:
Given the following invocation:
that would return the string '123456', because the args are first concatenated into '654321', then that string is reversed by reverse.
So perhaps you see where this is going, now--the key is to get reverse into scalar context with as few keystrokes as possible, and to have it work on strings as well as numbers.
To do this, you can use the bitwise negation operator '~', which (if you read perlop) also works on strings. Just negate the string twice, and you have the original string; and the operator puts reverse into scalar context.
And you're done.