Hi guys! When writing to a file there is a space inserted in front of every row except the first one. Why is that and how do I get rid of it? Any nice soul out there who knows?!?
I've had this problem with all my scripts for several years but now I cannot live with it anymore...;) Does it have something to do with me running in a windows environment? (Win XP) I post an example program which generates a new file from another. The file dummy_file.txt can be any simple textfile. When comparing dummy_file.txt with new_dummy_file.txt one can see the spaces inserted on every row but the first. For example it looks like this in the dummy_file.txt row1 row2 row3 And then like this in the new_dummy_file.txt row1 row2 row3 brgds Andreas #!/usr/local/bin/perl # # Program to do the obvious ;) #useage: perl -w read_write_test.pl use strict; use strict 'refs'; $|=1; #Flush ON # Print a message print "Script started.\n"; #open a file to read from open(INPUT, "dummy_file.txt") || die "Error opening file dummy_file.txt $!\n"; my(@input_lines) = <INPUT>;# Read file into an array close(INPUT); #open file to put the lines in open(OUTPUT, ">new_dummy_file.txt")|| die "Error opening file new_dummy_file.txt. $!\n"; # Print the array in the new file print OUTPUT "@input_lines"; close(OUTPUT); exit(0); H�strusk och gr� moln - k�p en resa till solen p� Yahoo! Resor p� adressen http://se.docs.yahoo.com/travel/index.html _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
