It's actually more lines than it appears since the author has concatenated lines with a semi-colon:
my $size=8;my @cols=(0..$size-1);
my $row=@_;next if grep ($_ == $col-$row--, @_);
my $row=@_;next if grep ($_ == $col+$row--, @_);
Strictly speaking that's 6 lines of code concatenated into 3.But as you said, it would be relatively easy to golf that down and still keep the program logic.