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