I still feel that's cheating as you're just replacing the semi-colon with braced blocks; effectively it's still being parsed as multiple lines.
I was thinking more along the lines of using the one line conditional:
condition ? first_expression : second_expression;
eg
sub nextq {
(print( "@_\n" ),return) if @_ == (my $size = 8);
foreach my $col(0..$size-1) {
my ($row, $next);
grep ($_ == $col, @_) ? $next=1 : $row=@_;
grep ($_ == $col-$row--, @_) ? $next=1 : $row=@_;
grep ($_ == $col+$row--, @_) ? $next=1 : $row=@_;
nextq(@_,$col) unless $next;
}
}
nextq();
The `$next` ugliness is due to not being allowed to use the `next` inside a one line conditional. There's probably cleaner ways of doing the above though. But that was only a quick hack.