diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-02-07 09:30:47 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-02-07 09:30:47 +0000 |
commit | 62c18ce2c158fdc3401f5009417ddcfd1effff4a (patch) | |
tree | d2a8ffb909a7e8eee3ed9b0b8d9101e612b93589 /pod | |
parent | c8984b0bd19897e6e30588055ac0338326f20a34 (diff) | |
download | perl-62c18ce2c158fdc3401f5009417ddcfd1effff4a.tar.gz |
properly prototype check parenthesized unary ops (e.g. defined(&a,&b))
p4raw-id: //depot/perl@2817
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldelta.pod | 23 | ||||
-rw-r--r-- | pod/perlfunc.pod | 17 | ||||
-rw-r--r-- | pod/perlop.pod | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 9bb27ab028..17ca348f95 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -62,6 +62,29 @@ somewhat 64-bit aware platforms are HP-UX 11 or better, Solaris 2.6 or better, IRIX 6.2 or better. Naturally 64-bit platforms like Digital UNIX and UNICOS also have 64-bit support. +=head2 Better syntax checks on parenthesized unary operators + +Expressions such as: + + print defined(&foo,&bar,&baz); + print uc("foo","bar","baz"); + undef($foo,&bar); + +used to be accidentally allowed in earlier versions, and produced +unpredictable behavior. Some of them produced ancillary warnings +when used in this way, while others silently did the wrong thing. + +The parenthesized forms of most unary operators that expect a single +argument will now ensure that they are not called with more than one +argument, making the above cases syntax errors. Note that the usual +behavior of: + + print defined &foo, &bar, &baz; + print uc "foo", "bar", "baz"; + undef $foo, &bar; + +remains unchanged. See L<perlop>. + =head1 Supported Platforms =over 4 diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index ef27b8b44a..3b5c5dd6d4 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3069,6 +3069,23 @@ needed. If you really wanted to do so, however, you could use the construction C<@{[ (some expression) ]}>, but usually a simple C<(some expression)> suffices. +Though C<scalar> can be considered in general to be a unary operator, +EXPR is also allowed to be a parenthesized list. The list in fact +behaves as a scalar comma expression, evaluating all but the last +element in void context and returning the final element evaluated in +a scalar context. + +The following single statement: + + print uc(scalar(&foo,$bar)),$baz; + +is the moral equivalent of these two: + + &foo; + print(uc($bar),$baz); + +See L<perlop> for more details on unary operators and the comma operator. + =item seek FILEHANDLE,POSITION,WHENCE Sets FILEHANDLE's position, just like the C<fseek()> call of C<stdio()>. diff --git a/pod/perlop.pod b/pod/perlop.pod index a485781e40..01c5d0ef51 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -44,7 +44,7 @@ Many operators can be overloaded for objects. See L<overload>. =head2 Terms and List Operators (Leftward) -A TERM has the highest precedence in Perl. They includes variables, +A TERM has the highest precedence in Perl. They include variables, quote and quote-like operators, any expression in parentheses, and any function whose arguments are parenthesized. Actually, there aren't really functions in this sense, just list operators and unary |