develooper Front page | perl.beginners | Postings from February 2002

getting rid of additional space in array output

Thread Next
From:
M z
Date:
February 24, 2002 20:49
Subject:
getting rid of additional space in array output
Message ID:
20020225044918.93287.qmail@web20905.mail.yahoo.com
hello

I need some help badly on this slight technicality I
am facing.  I am reading every line of input into a
scalar variable, spllitting on null, to get every
character into an array, and then splicing.  When I
pring the array elements of interest, a space is
appended to the input.  Please help!!!

Code:

....
while(defined($line=<F>)) {
chomp($line);
....
@l = split(//, $line);
		if ($l[69] eq " ") {
                @right = splice(@l, 70, $#l);
                @left = splice(@l, 0, 69);
                print F1 "@left\n";
		print F1 "+ @right\n";
		}


example input: (continuuos) element 69 (at position
70)
is the space
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
XXXX

output:
H H H H H H H H H H H H H H H H H H H H H H H H H H H
H H H H H H H H H H H H H H H H H H H H H H H H H H H
H H H H H H H H H H H H H H H
+ X X X X

desired output would be like above output, without the
spaces!!!

so, is there a way when I splice to get rid of the
space???

thanks this is probably a lot easier than I am making
it out to be!!





__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About