in reply to Dereferenced Arrays


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:

sub poo { print "in sub poo\n"; print Dumper( \@_ ); # rest of your code here }
You will easily be able to determine what actually got passed to the sub.

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
    yeah i tend to use strict; when trying to debug... a lot of times it starts shreiking to high hell when i dont state the scope of the variables im using. so i normally throw it in there when im having trouble, but it didnt give me any errors. the only thing im having problems with at this point, is the fact that i cant print the contents of @array either by using it in quotes or not. still gives me

    ARRAY[ 0xmemaddy]