Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Dereferenced Arrays

by bobf (Monsignor)
on Aug 19, 2009 at 00:24 UTC ( [id://789641]=note: print w/replies, xml ) Need Help??


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:

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]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://789641]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found