You must be invoking the wrong script or something after adding strict and warnings if you're getting no errors or warnings. I assure you it's not because I didn't have the full script.

I've written you a very small sample script that at least shows you how you can make your code cross-platform compatible... it runs for me on either Unix or Windows systems without any changes. Modify the $dir paths to your environment and try it to see what happens.

#!/usr/bin/env perl use warnings; use strict; use File::Find; my $dir; if ($^O eq 'MSWin32'){ $dir = "c:\\users\\steve\\devel\\repos"; } else { $dir = "/home/steve/devel/repos"; } find({ wanted => \&do_file, no_chdir => 1 }, $dir); sub do_file { my $file = $File::Find::name; if (! -f $file){ return; } print "$file\n"; }

-stevieb


In reply to Re^5: Perl Script in Windows Works, but not in Unix by stevieb
in thread Perl Script in Windows Works, but not in Unix by dobster936

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.