Gossamer Forum
Home : General : Perl Programming :

array -- annoying space

Quote Reply
array -- annoying space
Hi 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 arrayfile.txt and the displayed
output of the array.


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


#!/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;
print $localtime;
#---------------------------------
$fname = "F:/webtest/test/cgi-bin/help3/arrayfile.txt";
open (ARRAYFILE, ">$fname");
print ARRAYFILE "@array\n";
close (ARRAYFILE);
Subject Author Views Date
Thread array -- annoying space courierb 8639 Aug 21, 2004, 3:37 AM
Post Re: [courierb] array -- annoying space
Andy 8504 Aug 21, 2004, 6:20 AM
Post Re: [courierb] array -- annoying space
Chaz 8449 Aug 21, 2004, 7:13 PM
Thread Re: [courierb] array -- annoying space
Crolguvar 8412 Aug 26, 2004, 9:18 AM
Post Re: [Crolguvar] array -- annoying space
courierb 8359 Sep 11, 2004, 8:35 PM
Thread Re: [Crolguvar] array -- annoying space
courierb 8431 Sep 12, 2004, 1:08 AM
Post Re: [courierb] array -- annoying space
courierb 8342 Sep 12, 2004, 2:08 AM