AnomalousMonk has asked for the wisdom of the Perl Monks concerning the following question:
Now, here's something I don't understand:
Apparently, dereferencing an undefined value in the context of a user-defined subroutine call takes the stink off of this strict no-no. Huh?!? What am I missing? A statement like my @ra = @$ar; is also fatal as expected. (Tested under ActiveState 5.8.9 and Strawberry 5.14.4.1.)c:\@Work\Perl\monks>perl -wMstrict -le "my $ar; print(@$ar); print 'done'; " Can't use an undefined value as an ARRAY reference at -e line 1. c:\@Work\Perl\monks>perl -wMstrict -le "sub foo { return @_; } ;; my $ar; print foo(@$ar); print 'done'; " done
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dereference of undefined value OK under strictures?
by LanX (Saint) on Jun 28, 2019 at 20:18 UTC | |
by AnomalousMonk (Archbishop) on Jun 28, 2019 at 21:28 UTC | |
by Anonymous Monk on Jun 28, 2019 at 22:09 UTC | |
by afoken (Chancellor) on Jun 30, 2019 at 11:05 UTC | |
by LanX (Saint) on Jun 30, 2019 at 12:35 UTC | |
|
Re: Dereference of undefined value OK under strictures?
by Don Coyote (Hermit) on Jun 29, 2019 at 08:25 UTC | |
by LanX (Saint) on Jun 30, 2019 at 00:46 UTC | |
by Don Coyote (Hermit) on Jun 30, 2019 at 12:51 UTC | |
by LanX (Saint) on Jun 30, 2019 at 13:07 UTC |