Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Replace and substitur in same file

by Anonymous Monk
on Jun 21, 2017 at 05:24 UTC ( [id://1193196]=note: print w/replies, xml ) Need Help??


in reply to Replace and substitur in same file

Hi,

Open the source file, checking for success.

Open a destination file, checking for success.

Read source file line by line, make substitutions, write to destination file.

Close files for neatness ( OCD, I can't help myself ).

Check for success everywhere you can.

Start EVERY program with strictures. For at least the next 5 years.

J.C.

Replies are listed 'Best First'.
Re^2: Replace and substitur in same file
by GrandFather (Saint) on Jun 21, 2017 at 09:44 UTC
    Start EVERY program with strictures. For at least the next 5 years.

    Nah. Forever. The cost is nothing and the benefit, just from spotting typos, way out strips the cost of admission.

    Premature optimization is the root of all job security

      Well, in five years, it should be safe to abandon old versions of Perl, and just:

      use 5.012;

      which is better than use strict because it enables strict mode without needlessly loading a module.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-06-24 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.