February 2019 Archives

I'm not positive about this...

I'm not positive about this, but I'm not sure that things are behaving as I would expect. What would you expect the following lines to output?

perl -E 'say "x"; say -"x"; say -"-x"; say -"+x";'

For me, lines 1 and 2 make sense. Lines 3 and 4 are different than I would expect, but I'm not sure that they are really wrong. Does somebody want to explain what is really happening, and why it is that way?

About $Bob

user-pic I blog about Perl.