nick321 has asked for the wisdom of the Perl Monks concerning the following question:
I have written code to copy contents of one file to another.
It perfectly works fine for the .txt file.
But when I try for .doc file, it doesn't work.
#!/usr/bin/perl use 5.010; use strict; # Open file to read unless (open(DATA1, "file1.doc")) { die "couldn't open file1" }; # Open new file to write unless (open(DATA2, ">>file2.doc")) { die "couldn't open file2" }; # Copy data from one file to another. while(<DATA1>) { print DATA2 "$_\n"; } close( DATA1 ); close( DATA2 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Working with word document
by philiprbrenan (Monk) on Aug 27, 2012 at 22:27 UTC | |
|
Re: Working with word document
by aaron_baugher (Curate) on Aug 27, 2012 at 22:14 UTC | |
|
Re: Working with word document
by Kenosis (Priest) on Aug 27, 2012 at 22:33 UTC | |
|
Re: Working with word document
by 2teez (Vicar) on Aug 27, 2012 at 21:43 UTC | |
by nick321 (Initiate) on Aug 27, 2012 at 22:15 UTC | |
by 2teez (Vicar) on Aug 27, 2012 at 22:41 UTC | |
by nick321 (Initiate) on Aug 27, 2012 at 23:15 UTC | |
by 2teez (Vicar) on Aug 27, 2012 at 23:43 UTC | |
| |
|
Re: Working with word document
by aitap (Curate) on Aug 28, 2012 at 13:42 UTC |