my($ret) ||= foo(); #### 1. my ($ret); # Create a scalar variable called $ret 2. $ret ||= foo() # If $ret is undefined or zero, assign it to foo() #### my($ret) = $ret || foo(); #### use strict; use warnings; my $x = $x || 5; print "Now x = $x\n"; #### Now x = 5 #### Global symbol "$x" requires explicit package name at test.pl line 5. Execution of test.pl aborted due to compilation errors. #### use strict; use warnings; my $y = 7; my $x; $x = $x || $y; print "Now x = $x\n"; #### use strict; use warnings; my $y = 7; my $x; $x ||= $y; print "Now x = $x\n"; #### Now x = 7