The Perl 5.12 yada yada operator

Perl v5.12 adds a placeholder operator, ..., called the yada yada operator, after an episode of Seinfeld where the interesting parts of the story are replaced with “yada yada yada”.

You can replace whole statements with ... and Perl will compile it. You can check that everything else compiles without having to fill in the bits you have deferred.

Here’s a simple program that compiles:

use v5.12;


When you check the syntax, everything is fine:

$ perl5.12 -c syntax OK

At runtime, the ... dies with the message Unimplemented:

$ perl5.12
Unimplemented at line 3.

Before this feature, you might have inserted comments to mark the places you needed to return to:

use v5.12;

# XXX: do that thing we talked about right here

Being comments, these do compile, but being comments, they let the program continue past them like it worked despite part of it missing. The ... stops the program to remind you that you aren’t done yet.

The ... doesn’t work as a placeholder for terms or partial statements:

use v5.12;

... + ...

Those don’t compile:

$ perl5.12 -c
syntax error at line 3, near "... +" had compilation errors.

You can make these into statements though by enclosing then in do:

use v5.12;

do{...} + do{...}
Leave a comment


Leave a Reply

[ Ctrl + Enter ]