I happen to meet a perl code with the following syntax.
sub new{
my ($class, $value)=@_;
$lobby ||= bless{
e=>undef;},$class
}
what does the syntax ||= mean?
I failed to google it as a key word, and I could not find similar syntax in the perldoc.
You’ll find the meaning of operators in perlop.
Now what it does:
$lhs ||= $rhsis equivalent to$lhs = $lhs || $rhs. This means that$rhsis assigned to$lhsif$lhsis false in the Perlish sense. This can be if$lhsisundef, if it is an empty string, a number that is 0.