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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758201004, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/operators/bar_bar(54): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78