Dear allendevans,

Well that jumps out at me, since there are some very good coding habits for Perl also!

roboticus showed you the way you should write your code by scoping your variables with 'my' or 'local' or 'our'. If you had 'use strict' as roboticus had, your script would not compile and you would have the opportunity to write better Perl code. It is not that you pre-defined your variables, but that somehow that makes for better coding habits.

Do you think this code?

$date = ""; $time = ""; $ampm = ""; $filesize = 0; $filename = "";
is better or more clear than:
my ($date, $time, $ampm, $filesize, $filename) = split(" ", $line);
I like that you commented you code very well, but it was that comment above that needs to be changed/improved/removed. This may seem like a nit now, but if you continue to grow with Perl, then learning good Perl coding habits now, will help you in the future.

Good Luck!

"Well done is better than well said." - Benjamin Franklin


In reply to Re: How to Remove Commas ? by flexvault
in thread How to Remove Commas ? by allendevans

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.