Search notes:

Perl operator: || (bar bar)

The slash slash operator in perl returns the left side value if it is true, otherwise it returns the right side value. This differs from the // operator in that the // operator checks for definendness rather than truth.
use warnings;
use strict;
use feature 'say';

my $p;
my $q  = "foo";
my $r  = "";
my $t  = "0";


say $p || "bar"; # bar
say $q || "bar"; # foo
say $r || "bar"; # bar
say $t || "bar"; # bar
Github repository about-perl, path: /operators/bar_bar.pl

See also

Perl operators

Index