in reply to <SOLVED>Dereferencing arrays
Not only does the & form make the argument list optional, it also disables any prototype checking on arguments you do provide.
$ perl -le 'sub foo(\@) { ref(shift) ? "ref" : "not a ref" }; @arr=(1. +.3); print foo(@arr)' ref $ perl -le 'sub foo(\@) { ref(shift) ? "ref" : "not a ref" }; @arr=(1. +.3); print &foo(@arr)' not a ref
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dereferencing arrays
by divitto (Novice) on Mar 19, 2014 at 20:37 UTC | |
by divitto (Novice) on Mar 19, 2014 at 20:55 UTC |