# open multiple filehandles at the same time # copy content to another file open (SOURCEFILE, "mysubdir/myinputfile.txt") || die; open (DESTFILE, ">mysubdir/myoutputfile_2.txt") || die; @contents = ; print DESTFILE @contents; close SOURCEFILE; close DESTFILE; open (SOURCEFILE, "mysubdir/myinputfile.txt") || die; open (DESTFILE, ">mysubdir/myoutputfile_3.txt") || die; while (defined ($line = )) { #you can do work here to update the line $line = uc $line; #uppercase print $line; print DESTFILE $line; } close SOURCEFILE; close DESTFILE; #three free file handlers #by default, connect to terminal