Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: perl error

by dreadpiratepeter (Priest)
on Jul 29, 2011 at 00:10 UTC ( #917372=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl error
in thread perl error

Actually, your code has a number of problems.

  • that isn't how you initialize a 2-dimensional array. your initialization of @matrix will make a 722 element 1d array. You would need something like: @matrix=map {[(0) x 361]} (0..361);
  • From what I can see you want:  $Matrix[$a+180][$b+180] += 1;

I would suggest giving Modern Perl or Learning Perl and Programming Perl a good read to get down some of the fundamentals.

Update: Also you set $a and $b to values, then immediately set them to int($phi) and int($psi) which are undefined. If you were running with strict and warnings the compiler would have shown you that.



-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."


Comment on Re^3: perl error
Select or Download Code
Re^4: perl error
by topaz (Initiate) on Jul 29, 2011 at 00:29 UTC
    Many thanks for your advice :) I will try my best

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2015-07-01 20:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls