The equivalent would actually be
$ret ||= (foo())[-1]; [download]
In reply to Re^2: Why are "a ||= b" and "a = a || b" different? by ikegami in thread Why are "a ||= b" and "a = a || b" different? by saintmike