On Fri, Jun 20, 2008 at 08:04:27AM -0700, Nicholas Clark wrote: > $ ./perl -Ilib -e 'sub foo {return return}' > $ > > How come this isn't a syntax error? It can't possibly do anything useful. > (Actually, it seems that anything can be passed the return value of return. > C<print return> works just fine). > It seems to me that there's lots of useless code that nonetheless isn't a syntax error... :) Perhaps that construct could generate a warning. Personally, I wouldn't expect it to be a syntax error. (Note that return can be usefully used as an expression: my $foo = $bar ? return : 'baz'; Odd, but it works.) RonaldThread Previous | Thread Next