How can you edit a file inline.

I can of course open it and then write it out back to a tmp file. Then
rename the files.

But is there a way to do it inline so that perl handles the temp files and
cleanup?

I have seen tons of examples using the command line but how can you do it in
a script.

For instance.

foreach (glob ("*.pl"){
    open ( IN, "<$_" ) or die ("Cannot open file $_ $!\n" );
    while (<IN>){
        $_ =~ s/dbi:xxx:xxx/dbi:yyy:yyy/;
    }
}

Paul Kraus



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to