On Wed, Jun 15, 2005 at 01:30:12PM +0200 demerphq wrote: > On 6/15/05, Tassilo von Parseval <[EMAIL PROTECTED]> wrote: > > so it's not that the current behaviour should be such a surprise to an > > experienced user. For me it's mostly an aesthetic question really. Do we > > want this couple: > > > > print $x +$y; # means: $x + $y > > print { $x } +$y; > > > > or rather this one: > > > > print $x +$y; # means: print { $x } +$y; > > print $x + $y; > > > > The second one is visually less offending. Futhermore, there is no > > style-guide I know of that suggests using a space before a binary > > operator but not after it. Perl should make such ugliness as hard to > > employ as possible. > > I'm with Schwern. The first one is the only logical scenario. > > print $x +$y; # should mean $x + $y always > print $x $y; # should mean print { $x } $y > > since the latter is legal and the recommended way to write to a > lexical filehandle making the former a synonym for it seriously > violates the principle of least surprise. Also taking this approach > the docs become correct again i think.
They are still incomplete then. From 'perldoc -f print': Note that if you're storing FILEHANDLES in an array or other expression, you will have to use a block returning its value instead: print { $files[$i] } "stuff\n"; print { $OK ? STDOUT : STDERR } "stuff\n"; Note how that implies that I can always use a simple scalar as filehandle without the need for a block. Other than that, there is no logical scenario here. Unary plus and minus are legitimate operators in Perl. Assuming the user meant the binary counterparts is an entirely arbitrary decision. As is the notion that I suggest (namely to keep the current behaviour). There is no logic that would solve the kind of syntactic ambiguity we have here. Having said that, I don't think we should change a behaviour that existing code might be relying on for no real gain (other than a merely perceived increase in consistency). Tassilo -- use bigint; $n=71423350343770280161397026330337371139054411854220053437565440; $m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);