in reply to elements not reversing inside a map

reverse in a list context is a list reverse. If you want a string reverse, you have to have a scalar context. Try adding "scalar" in front of your first "reverse".

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: elements not reversing inside a map

Replies are listed 'Best First'.
Re^2: elements not reversing inside a map
by Transient (Hermit) on May 05, 2005 at 20:35 UTC
    Ok, I had overlooked that map evaluated $_ in a list context.

    My question below stil stands, however. Why does (reverse $_)||"" work?
        Ok, but why? Shouldn't the short-circuit operator take effect then?

        From perlop:

        Scalar or list context propagates down to the right operand if it is evaluated.
        But that's "if" it is evaluated... which it doesn't seem like it would be.