First of all, please put the following two lines at the top of your program:
use strict; use warnings;
Then, when you rerun the program, you will get a bunch of errors:
Global symbol "$dinu_r" requires explicit package name at x line 15. Global symbol "@energy" requires explicit package name at x line 20. Global symbol "@energy" requires explicit package name at x line 21. Type of arg 1 to push must be array (not concatenation (.) or string) +at x line 21, near "})" syntax error at x line 29, near "..." Execution of x aborted due to compilation errors.
Obviously the syntax error at x line 29, near "..." is caused by the "..." you used to show omitted code, so you can ignore that (or, better yet, comment it out). For the 3 errors containing "requires explicit package name", you should declare them somewhere using "my", and assign them as well. Until you do, we can't know for sure what the problem in your program is.
Another thing you should absolutely do is provide error-checking when opening files doesn't work. If you aren't successful opening an input file, it's pretty pointless to keep going, and trying to read from the input filehandle! Here's an example of how you can check the results of your open:
my $input = "shuffle$x"; open (AA, $input) or die "Can't open input '$input' ($!)\n"; # LINE A
If you can fix these problems, try resubmitting the program.
In reply to Re: Changing name of ARRAY in each iteration
by liverpole
in thread Changing name of ARRAY in each iteration
by cool
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |