File input/output: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
 
No edit summary
Line 3: Line 3:
==Perl==
==Perl==
'''Interpreter:''' [[Perl]] 5.8.8
'''Interpreter:''' [[Perl]] 5.8.8
<pre><nowiki>#!/usr/bin/perl -w
#!/usr/bin/perl -w

open INPUT, "<input.txt";
open INPUT, "<input.txt";
open OUTPUT, ">output.txt";
open OUTPUT, ">output.txt";

while ( <INPUT> ) {
while ( <INPUT> ) {
print OUTPUT $_;
print OUTPUT $_;
}
}
</nowiki></pre>

Revision as of 20:54, 9 January 2007

In this task, the job is to create a file called "output.txt", and place in it the contents of the file "input.txt".

Perl

Interpreter: Perl 5.8.8

#!/usr/bin/perl -w

open INPUT, "<input.txt";
open OUTPUT, ">output.txt";

while ( <INPUT> ) {
  print OUTPUT $_;
}