Perl ... unwanted space at start of line 2 onwards in file

by "Peter Newton" <c-newton(at)ihug.co.nz>

 Date:  Sun, 5 Mar 2000 20:04:54 +1300
 To:  <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
Hello All,
In the following code I find an annoying space
which appears at the start of the 2nd and each 
subsequent line both in the file and the displayed
output of the array.

Does anyone know what is going on and how to
avoid this problem.

Here is the code:-

#!/usr/bin/perl

$localtime = localtime;

#---------------------------------
$line0="$localtime|this is line 0\n";
$line1="$localtime|this is line number 1\n";
$line2="$localtime|this is line No 2\n";

@array=();
push (@array,$line0,$line1,$line2);

print "@array\n";
#---------------------------------
$fname = "arrayfile.txt";

open (ARRAYFILE, ">$fname");
print ARRAYFILE "@array\n";
close (ARRAYFILE);


Many Thanks
Peter Newton

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA