diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-05 20:48:49 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-05 20:48:54 -0800 |
commit | c7102404ab5c18fd683fb5264665505b169ba928 (patch) | |
tree | 482c9e8a97e186af743124f3ff6e935cfea06caf /pod/perlop.pod | |
parent | 480e0d3cb5dd65d869513ab5419347ef0d1c9763 (diff) | |
download | perl-c7102404ab5c18fd683fb5264665505b169ba928.tar.gz |
perlop: remove triple-dot
This has been superseded by c2f1e229, which adds it
to perlsyn.
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 21040b3d00..80add657e2 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1125,72 +1125,6 @@ lvalues assigned to, and a list assignment in scalar context returns the number of elements produced by the expression on the right hand side of the assignment. -=head2 The Triple-Dot Operator -X<...> X<... operator> X<yada-yada operator> X<whatever operator> -X<triple-dot operator> - -The triple-dot operator, C<...>, sometimes called the "whatever operator", the -"yada-yada operator", or the "I<et cetera>" operator, is a placeholder for -code. Perl parses it without error, but when you try to execute a whatever, -it throws an exception with the text C<Unimplemented>: - - sub unimplemented { ... } - - eval { unimplemented() }; - if ($@ eq "Unimplemented" ) { - say "Oh look, an exception--whatever."; - } - -You can only use the triple-dot operator to stand in for a complete statement. -These examples of the triple-dot work: - - { ... } - - sub foo { ... } - - ...; - - eval { ... }; - - sub foo { - my ($self) = shift; - ...; - } - - do { - my $variable; - ...; - say "Hurrah!"; - } while $cheering; - -The yada-yada--or whatever--cannot stand in for an expression that is -part of a larger statement since the C<...> is also the three-dot version -of the binary range operator (see L<Range Operators>). These examples of -the whatever operator are still syntax errors: - - print ...; - - open(PASSWD, ">", "/dev/passwd") or ...; - - if ($condition && ...) { say "Hello" } - -There are some cases where Perl can't immediately tell the difference -between an expression and a statement. For instance, the syntax for a -block and an anonymous hash reference constructor look the same unless -there's something in the braces that give Perl a hint. The whatever -is a syntax error if Perl doesn't guess that the C<{ ... }> is a -block. In that case, it doesn't think the C<...> is the whatever -because it's expecting an expression instead of a statement: - - my @transformed = map { ... } @input; # syntax error - -You can use a C<;> inside your block to denote that the C<{ ... }> is -a block and not a hash reference constructor. Now the whatever works: - - my @transformed = map {; ... } @input; # ; disambiguates - - my @transformed = map { ...; } @input; # ; disambiguates - =head2 Comma Operator X<comma> X<operator, comma> X<,> |