perlop - Assignment Operators may help. The assignment operator returns the object assigned to as an lvalue so your assignement and test is fine.
Update:
I'd be inclined to rewrite that as:
while ( $self ) { $path += $self->get_branch_length if $self = $self->get_parent; } return $path;
In reply to Re: assignment operator return values
by GrandFather
in thread assignment operator return values
by rvosa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |