#usr/perl -w use strict; my $inPath = "somepath"; my $outPath= "outfile"; my $largefile = "large file"; open (INFILE, "<", $path2File) or die "Can't open $path2File for read"; open (OUTFILE, ">", $outPath) or die "Can't open $outpath for write"; open (LARGE, ">",$largefile) or die "Can't open $largefile for write"; #I don't see why this is necessay! #do something here.... while () { .... print OUTFILE "some_data\n"; } #in general, open the files that you #need to use at the beginning of the program and then #use those file handles. #A "re-open" of a file handle for append is very #"expensive" thing within a loop in terms of performance. #Don't do that.