in reply to Re: Bug with substring return value?
in thread Bug with substring return value?

This allows you to replace parts of the EXPR and return what was there before in one operation

But that's not what this is doing. I'm getting the assigned value or I'm missing something deceptively obvious.
update
I had my stupid hat on today.


-Lee

"To be civilized is to deny one's nature."
  • Comment on Re: Re: Bug with substring return value?

Replies are listed 'Best First'.
Re: Re: Re: Bug with substring return value?
by Dog and Pony (Priest) on Apr 13, 2002 at 12:54 UTC
    Ok, here is what I think is happening (according to the examples above):
    $y = 42; $x = $y; substr( $string, 2, 6 ) = ''; $result = substr( $string, 2, 6 );
    The other ways of writing it, $x = $y = 42; and your example are just shorthand ways.

    And perldoc specifically mentions the way when you use a fourth argument instead as an alternative where you can get the replaced values back, unlike the assignment way.


    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
      DOH!
      Apparently when I code 20 hour straight I lose the basic ability to do simple addition. I'm not quite firing on all cylinders today.

      ++Thanks you for the very polite (considering the stupidity of my reply) dope slap.



      -Lee

      "To be civilized is to deny one's nature."