Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Odd behaviour of chomp()

by Laurent_R (Canon)
on Oct 20, 2015 at 15:48 UTC ( [id://1145453]=note: print w/replies, xml ) Need Help??


in reply to Re: Odd behaviour of chomp()
in thread Odd behaviour of chomp()

To me, all the four examples you provide return a perfectly valid result, or at least exactly the result I would expect. So nothing wrong with them IMHO.

Contrary to the OP's question, which really appears to be displaying an actual bug.

Update: Of course, I meant: all the four examples as originally provided by sundialsvc4 return a perfectly valid result. The last example, as it stand now, does no longer return a valid result, but that example was changed by its author almost 24 hours after I posted my comment above. Fortunately, hippo provided a copy-and-paste of the last example as it was originally posted and as it was when I answered, thus showing that this comment was right at the time.

Replies are listed 'Best First'.
Re^3: Odd behaviour of chomp()
by Salvor (Novice) on Oct 20, 2015 at 16:11 UTC

    Many thanks to you all!

    Conclusions like "It's a bug" or "It appears to be a bug" are perfectly ok for me ;-)

Re^3: Odd behaviour of chomp()
by sundialsvc4 (Abbot) on Oct 21, 2015 at 14:14 UTC

    The corrected example merely repeats the originally reported bug.

    Certainly won’t be the first time that an optimizer produced incorrect results.   Delphi-6 had a similar bug, too, that vexed me for a time.   It is almost a general rule-of-thumb that, if calling any function that modifies one of its inputs, do not assign the result back to the same variable.   Optimizers like to remove “unnecessary” loads and stores, and they like to re-order things, and it becomes a gray area.   Just put the result down someplace else.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1145453]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-16 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found