Well, it's certainly not easier as you need to explicitely put a reference in (and later dereference the reference). I also doubt this would be more efficient if direct passing of arrays was available in Perl.why perl uses references to pass arrays?Because it's easier... and more efficient.
The real reason is that there's no way in Perl to directly pass an array - even with a @ prototype, you're still passing a reference. Perl flattens an array into a list when used in list context. That's the reason we use references (or globs, but that's very perl4-ish) to pass arrays.
Abigail
In reply to Re: I've read perlref
by Abigail-II
in thread I've read perlref
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |