M Z wrote:
>
> hello
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";
print F1 @left, "\n";
print F1 '+ ', @right, "\n";
> }
Or, without the splice:
while ( <F> ) {
chomp;
...
s/^(.{69}) (.*)$/$1\n+ $2\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!!!
Don't put the array in a double quoted string.
> so, is there a way when I splice to get rid of the
> space???
splice() isn't putting the spaces there.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]