On Oct 11, 2:37 am, [EMAIL PROTECTED] (PeiYu Zeng) wrote:
> Hello,
>
> Can I modify the contents of a file, without creating a new one?
>
> Now, the method that I modify the contents of a file is:
>     open( READHANDLE , "sourceFile" );
>     open( WRITEHANDLE, ">destiFile" );
>
>     foreach my $line (<READHANDLE>) {
>         if it accords with my rules {
>             modify $line;
>             print(WRITEHANDLE $line);
>         }
>     }
>
>     close(...);
>
> Is there a method that I could not create a new file to store the modified
> informations?
>
> Thanks,
> Zen

use Tie::File;
http://search.cpan.org/~mjd/Tie-File-0.96/lib/Tie/File.pm


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


Reply via email to