Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found