I have 2 questions. Here is the code: #!/usr/bin/perl use warnings; use strict;
# Merging two files print ("Write the two files you wan't to merge and \n"); print ("lastly the file to merge them too, seperated by a space.\n"); chop (my $filenames = <STDIN>); my @names = split(/ /,$filenames); # Get the filenames in an array. open (FIRSTFILE, "$names[0]") || die ("Couldn't open $names[0]'n"); my @firstfile = <FIRSTFILE>; open (SECONDFILE, "$names[1]") || die ("Couldn't open $names[1]\n"); my @secondfile = <SECONDFILE>; open (WRITEFILE, ">$names[2]") || die ("Couldn't open $names[2] for writing\n"); # Now to merge the 2 files. my $counting = 0; while ($firstfile[$counting] ne "" || $secondfile[$counting] ne "" ) { print WRITEFILE ($firstfile[$counting]); print WRITEFILE ($secondfile[$counting]); $counting++ } The first thing I don't understand. How come this works even if there are blank lines in a file, with text after that line? Shouldn't the while-loop end at blank lines? I have tested it on two files and it works on the whole file, even though there are blank lines there. Why is this? PS: The first file is 1 line, the second is 5 lines with line nr 4 beeing a blank line. Line 5 still shows though. PS2: I'm aware that my decision to use $counting is dumb, and that I instead should use the length of the longest array($firstfile or $secondfile), or isn't that a better solution? My second question is: When using use warnings; I get a long list of messages(warnings) when running this script. Use of uninitialized value in string ne at ./26.pl line 23, <SECONDFILE> line 6. Use of uninitialized value in print at ./26.pl line 24, <SECONDFILE> line 6.. I get this pair 6 times in a row, when the script is run. Is this a problem, or is it normal? PS: I'm just starting out, so don't flame me if the code is poorly written(feel free to comment though) :) Any information is greatly appreciated. Tor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]