There aren't many pitfalls. Any modules that you might encounter that you have doubts about can be checked against testing information.

The "\n" character cleanly prints CRLF. So you don't need to change your previous code. Perl is smart like that.

Windows 9x is less reliable than NT flavors, but that's just my observation.

Quick and Dirty newline fixer-uper (there's more than one better way to do this:)

#!/usr/bin/perl use strict 'vars'; use vars qw( @stuff $i @ARGV $fh ); $/ = undef; if (-e "$ARGV[0]"){ open ($fh, "+>>$ARGV[0]"); seek $fh,0,0; @stuff = <$fh>; foreach (@stuff){ $_ =~ s/\r/\n/mig; } seek $fh,0,0; truncate $fh,0; print $fh @stuff; close $fh; print "Done.\n"; } else{ print "Select a file that's actually there.\n"; }

Hope this helps.

John J Reiser
newrisedesigns.com


In reply to Re: General tips for Unix to Windows script migration? by newrisedesigns
in thread General tips for Unix to Windows script migration? by Bukowski

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.