As debugging 101, I ran the first part of your code (below). Making a simple example for us is good, but in the future please make it a "runnable as is" example.

An obvious problem is that colon ":" is not valid in a Windows file name. Also regardless of that issue, the complete path does look a bit suspicious to me - that path does not exist on the Windows machine I'm writing this post upon using to write this post.

#!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $creationTime = strftime "%F-%R:%S", localtime; my $sqlLog = "C:/Users/thclotworthy/squirrel/logs/squirrel-sql-" . $cr +eationTime . ".log"; my $scriptLog = "C:/Users/thclotworthy/squirrel/logs/squirrel-" . $cre +ationTime . ".log"; print "$sqlLog\n$scriptLog\n"; __END__ prints: C:/Users/thclotworthy/squirrel/logs/squirrel-sql--:23.log C:/Users/thclotworthy/squirrel/logs/squirrel--:23.log
As an extra updated note: I use Windows as my development platform and often move programs to a Unix environment. I try to only use file names that are compatible with both Windows and Unix. For example Windows allows a "space" in the name but Unix does not.(see post by choroba - my recollection of this is was evidently wrong). So I use underscore "_" instead of that (where possible). Of course there are situations on Windows where a space is need, e.g. "My Documents". Always use "/" instead of "\" for path names. That even works from the Windows command line (which BTW is NOT DOS). There are some weird situations where the backslash is needed, but I encounter this so rarely that I can't think of such an example right now. Perl is amazingly good at being multi-platform.

In reply to Re^3: script running on linux but not windows -- File::Spec by Marshall
in thread script running on linux but not windows by thadc

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.