in reply to Re: if defined not working
in thread if defined not working
Hi Athanasius,
I'm curious, what in your view is the advantage of using Logical Defined-Or over simple Logical Or in the OP's situation?
$ perl -Mstrict -Mwarnings -E' my $foo; say (defined $foo ? "1: defined" : "1: not defined"); my $bar = $foo; say "2: bar: $bar"; my $baz = $foo || "baz"; say "3: baz: $baz"; my $qux = $foo // "qux"; say "4: qux: $qux"; ' 1: not defined Use of uninitialized value $bar in concatenation (.) or string at -e l +ine 5. 2: bar: 3: baz: baz 4: qux: qux
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: if defined not working
by stevieb (Canon) on Feb 04, 2016 at 17:01 UTC | |
|
Re^3: if defined not working
by mr_mischief (Monsignor) on Feb 04, 2016 at 17:38 UTC |