Coding style is about writing code for maintainability.Computers may be able to read that and discern that you attempted to dereference a scalar. But humans get head-aches looking at it.

Compare what you offered, above, with:

my ( $my_tgid_list, $my_switchClli_list, $my_btfn_list ); my ( $my_custClli_list, $my_trkCount_list, $ $my_ldn_list); my ( $my_location_list, $my_status_list, $my_flag_list); my ( $eachrow, $tmp_tgid, $tmp_switchClli, $tmp_btfn); my ( $tmp_custClli, $tmp_trkCount, $tmp_ldn); my ( $tmp_location, $tmp_flag );
or

my ( $my_tgid_list, $my_switchClli_list); my ( $my_btfn_list, $my_custClli_list ); my ( $my_trkCount_list, $ $my_ldn_list); my ( $my_location_list, $my_status_list); my ( $my_flag_list, $eachrow); my ( $tmp_tgid, $tmp_switchClli); my ( $tmp_btfn, $tmp_custClli); my ( $tmp_trkCount, $tmp_ldn); my ( $tmp_location, $tmp_flag );
that code would give you an error identified by a line number which would not tax the attention span to decipher. (Speaking of which, will variable names like $tmp_btfn mean enough to you six months from now when you next look at this, that you won't have to decipher it?) Indeed, the very visual presentation of the code might have helped the human writing it to see the attempt to derefence $ $my_ldn_list, when coding the next line or three. I hadn't realized that the compiler would discard that extra space.

There is a lot I am still learning about how this compiler thingy works. I'm not a real perl hacker, like those folks who keep refactoring perl5 to make it into perl6. I'm just the kind of perl hacker who reads perldocs and learns how to use the perl5 that Creation and Its Servants saw fit to make available to help us get our job done. I'm finally starting to understand that if I can read it the computer can too.

-- Hugh


In reply to Re: Scalar dereference error by hesco
in thread Scalar dereference error by Anonymous Monk

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.