open DF,"test.txt"; binmode DF; my @test = ; close DF; my $rec; foreach(@test){$rec.=$_;} open (DF,'>test1.txt') || die ("Failed to open test1.txt: $!\n"); binmode DF; print DF $rec; close DF; #### open DF,"test.txt"; my @test=; close DF; # Print first 3 elements to prove read as an array print "Line 1=$test[0]
Line 2=$test[1]
Line 3=$test[2]
"; # Can we get around this? Waste of processing & memory! my $rec; foreach(@test){$rec.=$_;} open (DF,'>test.txt') || die ("Failed to open test2.txt: $!\n"); binmode DF; print DF $rec; close DF;