Mark-Nathaniel Weisman wrote: > I've got a script that reads a mail file, then copies it into an array. > The same script then pulls the data out of the array into another file > location. I've got a situation here, in that when I do the print > OUTFILE "@array"; it adds a singular space in front of each line after > the first, so the first line reads OK, but then the rest of the file is > off by one character, what am I doing wrong? > > open (INFILE, "<mailfile1") > or die "Error opening mailfile1.$!,stopped"; > @array = <INFILE>; > close(INFILE); > open (OUTFILE, ">>mailfile2") > or die "Error opening mailfile2.$!,stopped"; > print OUTFILE "@array";
You are not doing anything wrong, the extra space at the start is due to $" (perldoc perlvar). You have two options Change the print statement like this { local $" = ''; print OUTFILE "@array"; } or loop through @array and write the elements individually into OUTFILe > > close(OUTFILE); > > Can anyone help me on this, it would be greatly appreciated. > > His Faithful Servant, > Mark > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]