what does the double forward slash mean here?
From this page here: http://perldoc.perl.org/perlop.html#Logical-Defined-Or
Although it has no direct equivalent in C, Perl's
//
operator is related to its C-styleor
. In fact, it's exactly the same as||
, except that it tests the left hand side's definedness instead of its truth. Thus,EXPR1 // EXPR2
returns the value ofEXPR1
if it's defined, otherwise, the value ofEXPR2
is returned. (EXPR1
is evaluated in scalar context,EXPR2
in the context of//
itself). Usually, this is the same result asdefined(EXPR1) ? EXPR1 : EXPR2
(except that the ternary-operator form can be used as a lvalue, whileEXPR1 // EXPR2
cannot, and EXPR1 will only be evaluated once). This is very useful for providing default values for variables. If you actually want to test if at least one of$a
and$b
is defined, usedefined($a // $b)
.
Check for Logical Defined-Or in perlop, it is similar to ||
but it checks for undef
value (not false one).
Although it has no direct equivalent in C, Perl's // operator is related to its C-style or. In fact, it's exactly the same as ||, except that it tests the left hand side's definedness instead of its truth.
So in short,
my $abc = delete $args{ 'abc' } // croak 'some information!';
will croak when $args{ 'abc' }
returns undef
value.