Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Perl oddities

by bart (Canon)
on Mar 01, 2005 at 22:40 UTC ( #435642=note: print w/ replies, xml ) Need Help??

in reply to Perl oddities

First of all, I'd like open and opendir to have returned an open handle, or undef on failure, instead of changing a passed argument on the side. But Joost already mentioned that.

And second, I find it not just odd but also extremely annoying how the -X operators ignore parens as a hint for parsing precedence. Take this example:

print -M($0) + 1;
This yields:
Argument "" isn't numeric in addition (+) at line 2.
Use of uninitialized value in print at line 2.

Perl treats this the same as

print -M ($0 + 1);

Not exactly what I had in mind. You have to wrap the parens around both operator and argument, to make it behave like I want. Just like Applescript.

print +(-M $0)+1;

Comment on Re: Perl oddities
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-10-08 19:06 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (223 votes), past polls