File input/output

From Rosetta Code
Revision as of 14:45, 9 January 2007 by MikeMol (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 $_;
}