File input/output: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
In this task, the job is to create a file called "output.txt", and place in it the contents of the file "input.txt".
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==
==[[Perl]]==
'''Interpreter:''' [[Perl]] 5.8.8
'''Interpreter:''' [[Perl]] 5.8.8
#!/usr/bin/perl -w
#!/usr/bin/perl -w

Revision as of 21:25, 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 $_;
}