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

Re: Parsing hash reference as argument for subroutine

by Eily (Parson)
on Jan 06, 2014 at 11:54 UTC ( #1069493=note: print w/replies, xml ) Need Help??


in reply to Parsing hash reference as argument for subroutine

You should use strict and warnings, it would have helped you avoid some trouble.

$matrix is not declared, you should have a my $matrix = {}; at the beginning of the function. This function does not return $matrix. But then again, there are three { block opener but only two } block ends, this doesn't even compile.

To see what's inside a nested data structure (like a hash of hashes), you can use Data::Dumper like this :

use Data::Dumper; #At the top of the file ... print Dumper $P;

And at last, you probably want to read perldsc

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069493]
help
Chatterbox?
[vickycanada]: Hi, Can anyone please help me with this - 1203954
[vickycanada]: #1203954

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-11-21 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (312 votes). Check out past polls.

    Notices?