|
Posted by Tad J McClellan on March 14, 2008, 7:40 am
Please log in for more thread options > venkatesh.naughty@gmail.com schrieb:
>> Hi all,
>> How to assign array variable to a scalar retaining the content of the
>> array in the scalar variable not number of elements ;
>> eg:
>> @array=;
>> $x=@array;
>> I dont want $x to store 2
>> instead to store hi venkatesh
>
>
> Or maybe this one:
>
>
> @array = qw (hi venkatesh whats up);
>
> foreach (@array)
> {
> $x .= "$_ ";
> }
That leaves an extra space character at the end of $x.
$x = join ' ', @array; # no trailing space
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"
|