Why is this program valid? I was trying to create a syntax error

Perl has a syntax called “indirect method notation”. It allows

Foo->new($bar)

to be written as

new Foo $bar

So that means

Syntax error ! exit 0;

is the same as

error->Syntax(! exit 0);

or

error->Syntax(!exit(0));

Not only is it valid syntax, it doesn’t result in a run-time error because the first thing executed is exit(0).

Leave a Comment