Adam has asked for the wisdom of the Perl Monks concerning the following question:
get this warning:my %defaults = ref( $_[2+$[] ) ? %{$_[2+$[]} : {};
I only get the warning if there is no third argument. ref returns false when given undef, without any warnings as tested via:sub routine { my %override = %{$_[$[]}; # reference to a hash. my $var = $_[1+$[]; # scalar my %defaults = ref( $_[2+$[] ) ? %{$_[2+$[]} : {}; # optional hash + ref. #blah...
prompt> perl -we "print ref( undef() ) ? 'y' : 'n'" n
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reference found where even-sized list expected
by btrott (Parson) on Sep 13, 2000 at 23:55 UTC | |
by Adam (Vicar) on Sep 13, 2000 at 23:57 UTC | |
|
(jcwren) Re: Reference found where even-sized list expected
by jcwren (Prior) on Sep 13, 2000 at 23:56 UTC |