open(FROM, 'file.txt') or die "Can't open file.txt: $!"; open(TO, '>copied_file.txt') or die "Can't open copied_file.txt: $!"; print TO while ;