Hi Roger,
Thanks a lot for the feedback and useful criticism.

> 1) Add use strict; to the beginning of your code to prevent autovivification of variables.

Yes, by the time I posted it here I had already used strict everywhere. Initially I had error messagse that I could not understand but eventually got over.

> Do this instead: my $SOME_GLOBAL_VARIABLE=some_sub_without_side_effects();

You are right. But the way I needed to use was to have several variables to be returned, which would be easier with global variables than with several functions. :)

> 3) Remove the { } around the function calls, they are unnecessary and ugly.

I was intending to use eval... In retrospect, that was not required. Yes, I would be removing them now. :)

> 4) Use IO::File ...

Yes, I would be using it from now on. Thanks. :)

> 5) When modifying a Perl built-in variable, always create a scope and localize it first...

This has been a problem for me to understand, I need better books for advanced settings. I am not sure which are actually global and which are not.

My array sizes are huge so I was not sure if I should use subroutines which might duplicate all the variables upon passing the info, but I could not verify if it actually happens. These problems exists, but I could somehow write my first code.

> Anyway, good luck and happy Perl programming.

Thanks. It's been an ugly code, but I am happy to have shfted from FORTRAN for these things. :)

Sorry I could not reply earlier, was out for some trip.

Thanks a lot again. :)


In reply to Re: Re: Error not reported while processing an open file by qhayaal
in thread Error not reported while processing an open file by qhayaal

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.