Got another one!

This one is your basic parsing error, and hopefully easily fixed. Basically the return statement will not work without a value to return, unless you have a () after it (which I assume is not "correct" syntax, but also not really "wrong" syntax (but I will leave that for the language-designers to figure out)). Here are some basic tests I put into t/statements/return.t which illustrate the issue.

eval 'sub bar { return }';
eval_is('bar()', undef, '... bare return statement returned undef');

sub bar2 { return() }
is(bar2(), undef, '... bare return statement w/ parens returned undef');

eval 'sub foobar { return if 1; }';
eval_is('foobar()', undef, '... bare return worked with a statement modifier');


sub foobar2 { return() if 1; }
is(foobar2(), undef, '... bare return worked with a statement modifier');


- Stevan



Reply via email to