in reply to Re^3: Use of uninitialized value in substr
in thread Use of uninitialized value in substr

That's exactly what happens to the 4th arg of substr.

No it's not!. It replaces (a potentially null), part of the target string. That is not concatenation. Maybe a limitaion of your english?

Of course you can pass an undefined value to substr by accident..

Did I say you couldn't? What don't you understand about "explicit undef"?

ah! There wasn't even an allusion to this..

You think? Read again.

It's not one of those cases where I can't provide concrete explanation or example. It just reeks of trouble..

Ha! Do it! But you won't be getting counter-argument from me. Been down that road to many times and it is pointless.

You always arrive at a conclusion and then set out to prove it, rather than examine the up & downsides and then reach a conclusion.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy
  • Comment on Re^4: Use of uninitialized value in substr

Replies are listed 'Best First'.
Re^5: Use of uninitialized value in substr
by ikegami (Patriarch) on May 03, 2010 at 16:42 UTC

    It replaces (a potentially null), part of the target string. That is not concatenation.

    Replacing part of a string means concatenating the part that precedes the replacement with the replacement, and that with what follows the replacement.

    Did I say you couldn't?

    "why should you have to for something that could not possibly by "by accident""

    Read again.

    Done. Still don't see it. Not in the OP.

    Ha! Do it!

    Sorry, typo. I meant "It's not one of those cases where I can'tcan provide concrete ..."

    rather than examine the up & downsides and then reach a conclusion.

    Why do you bother commenting if you think I just make stuff up. You asked for our opinion, so I gave mine. I've already added five of my reasons to the post.

      "why should you have to for something that could not possibly by "by accident""

      Explain. How could your use of undef in your example, be "by accident"?

      $s = substr($s,0,1) . undef . substr($s,3);

      The rest. Equally misjudged.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      A reply falls below the community's threshold of quality. You may see it by logging in.