in reply to Dereferenced Arrays
Welcome!
I suspect that you are confusing arrays and lists. The distinction is a bit subtle (at first) but it is important. Instead of creating 3 arrays and calling poo with each set, you are actually creating one long list and calling the function once.
Are you familiar with Data::Dumper (or any of its cousins)? It comes in very handy when trying to understand what is going on with data. Without changing how you call the function, add use Data::Dumper; to the top (right after use strict; use warnings;) and try changing the sub to this:
You will easily be able to determine what actually got passed to the sub.sub poo { print "in sub poo\n"; print Dumper( \@_ ); # rest of your code here }
I need to emphasize use strict; again. If you had that in your code it would have given you a hint that something was amiss.
Hopefully that will give you enough info to complete the exercise. Feel free to ask for further clarification if you can't get it to work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dereferenced Arrays
by SirDonkeyPunch (Novice) on Aug 19, 2009 at 00:30 UTC |