XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
*sigh*
Why do we have to have nasty things like this in our language? :-( From perlop: Binary ".." is the range operator, which is really two different operators depending on the context. (emphasis mine) I always felt this was a point of needless confusion in perl. If the operator is really two operators, why not create two operators? Just make a range operator (array context only), and a flip flop operator (scalar context only), and report an error if the wrong one is used in the wrong context? That would eliminate this kind of error altogether, and make life easier to all concerned.
Wouldn't that have been wiser? Is it too late to fix it? Will Perl6 have the same mistake? Me, I don't like the flip-flop operator; I didn't understand it when I first ran across it, and now that I do, I still prefer to write my conditionals more verbosely. But I'd put up with it to appease the sed people (if the are any left), and create a range operator (or function), rather than deal with this kind of ugliness for newcomers (or for me when I'm sick, overtired, or called into work in the middle of the night). Even a function called "range" that returned a list from the first argument to the last argument would probably do.
Given that I can write this: it shouldn't be that much more confusing to write this: and leave the .. for the flip flop.
Just a thought...
-- In reply to Re: Slice Madness
by Anonymous Monk
|
|