Hello thadc and welcome to the monastery and to the wonderful world of Perl!

you already got good replies: yes you may need to adjust paths in the form (but as stevieb said c:/path/to is ok within windows) and for their content ( /opt does not exists at all on windows).

To make the program more portable I suggest you to use the core module File::Spec and all it's utilities: it'sa bit machinery to put in but very good choice in the long term.

Basically you must abstract the filling of every absolute path you intend to use, in the beginning of the program, then use them freely and safely. Using your example:

use strict; use warnings; use File::Spec; .. my @prog_dirs; # directory to find the program, still empty if ($^O eq 'MSWin32'){ @prog_dirs = qw(c: Programs devOps tools logs) } elsif $^O eq 'Linux'){ @prog_dirs = qw( opt devOps tools logs) } else{...} my $sqlLog = File::Spec->catfile( @prog_dirs, 'squirrel-sql-'.$creatio +nTime.'.log');

PS from the same module File::Spec->file_name_is_absolute File::Spec->rel2abs methods are very useful: everytime transform your paths into absolute ones!

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: script running on linux but not windows -- File::Spec by Discipulus
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.