On Wednesday 11 January 2006 15:11, Rajarshi Das wrote:
> Hi,
> The following one-liner replaces 'hola' with 'warnings' in-place in the
> script a.t.
>
> ./perl -e 's/hola/warnings/gi' -p -i.bak a.t
>
> However, it also creates a backup file a.t.bak with the original text.
>
> Is it possible that if an inplace edit is attempted without creating a
> backup file, perl cannot delete the original file to replace with the
> modified file and, the original file will be left unmodified ?

      If you want to just do an inplace edit then just use -i option without 
any extension like .bak

For example

perl -e  's/hola/warnings/gi' -p -i a.t

will do replace hola with warnings in the same file a.t

Ranish George

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to