in reply to Re^2: Newbie: parentheses, map, etc.
in thread Newbie: parentheses, map, etc.

The documentation lies. On failure, it returns the canonical false value, which is an empty string in string context and 0 in numeric context.

Replies are listed 'Best First'.
Re^4: Newbie: parentheses, map, etc.
by kyle (Abbot) on Mar 04, 2008 at 15:59 UTC

    Upon first reading this, I thought, "what's the difference?" More to the point, "how does one behave differently from the other?" After all, an empty string in a numeric context is zero anyway. How would one ever see the difference?

    Some time later, the answer popped into my head. A string turned number will trigger warnings, but s/// won't. I verified this in the Test::More fashion.

    Thanks for the food for thought.