what does perl operator “||=” do?

后端 未结 4 1325
逝去的感伤
逝去的感伤 2021-01-29 12:32

What does the operator ||= do in perl?

to be more specific if you have a code like:

my ($my_link);
$my_link  ||= DownloadF($file,\'l\') if          


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-29 13:01

    It assigns only if variable evaluates to false value. In each of your example lines, $my_link will only be assigned if the condition $s->{..} is true.

提交回复
热议问题