Several things happen here, but the most significant is the fact that such a line usually appears as the last line of an executable block [1]. In this context, the value of the block is the value of the last statement executed [2]. Now the expression containing contains the unlessvalue of the left side, if the right side is true and the value of the right side otherwise, so this is the way to say: "the value of the block $some_varif it $some_varturns out to be true, ()otherwise".
() - , , $some_var (, $some_var - undefined.)
or,
$some_var or ();
, :
use strict;
use warnings;
my @x = do { () unless 0 };
my @y = do { () unless 5 };
print "\@x: <@x>\n\@y: <@y>\n";
@x - , 0 , @y , 5, 5 .
, , () unless $some_var; -. once, $some_var .
[1]: , eval do () map grep, , .
[2]: " " - ; . Perl , , Perl .