Hi cool,

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.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: Changing name of ARRAY in each iteration by liverpole
in thread Changing name of ARRAY in each iteration by cool

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.