Personally I would change

open(MYNEWFILE, ">>$my_new_log:") or die "$my_new_log open() failed: $!";
to
open(MYNEWFILE, ">>$my_new_log") or die "$my_new_log open() failed: $!";

But that just means that the output file won't have a colon on the end. The colon isn't a valid filename character for Windows (if I recall correctly) and has special meaning on Macs. Not sure if it's a problem for Linux, though. I'd just remove it to be safe(r).

Also note that the >> before the $my_new_log means "open for append". So if you run this script multiple times the same file will have the new results added at the end. So if you change the way the script works, make sure to look at the end of the file to see them. I've burned myself a few times on this -- wondering why my new changes weren't showing up in the results file... If you want to make a new output file every time (and overwrite the old one) you can change >> to >


In reply to Re: Re: Re: Re: My first Perl script by Nkuvu
in thread My first Perl script by tarballed

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.