It's your use of prototypes that is burning you here. Your prototype of $$ means that both parameters are evaluated in scalar context and your array is therefore converted to the number of elements it contains (which is not what you want).
Prototypes in Perl don't do what most people expect them to do. They are generally more of a hindrance than a help. Unless you have one of the rare cases where prototypes are the only way to achieve a certain effect (like, for example, producing a function that works like "push") then they are best avoided. Remove the prototype from your subroutine and it will work as you expect.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: can i pass an array as an argument during a sub routine call???
by davorg
in thread can i pass an array as an argument during a sub routine call???
by sanjay nayak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |