On Feb 1, R. Joseph Newton said:
>vaishnavi krishnamurthy wrote:
>
>>Can anyone tell me how I can do the following - all the elements in my
>>array of unkown size should be initialised to the value 0 ? > > thanks,
>>vaish.
>
>No. If the array is of uknown size, it is not possible to do *anything*
vaishnavi krishnamurthy wrote:
> Hello,
>
> Can anyone tell me how I can do the following - all the elements in my array of
> unkown size should be initialised to the value 0 ?
>
> thanks,
> vaish.
No. If the array is of uknown size, it is not possible to do *anything* to all
elements. Theref
"Charles K. Clarkson" wrote:
> vaishnavi krishnamurthy <[EMAIL PROTECTED]> wrote:
>
> : Can anyone tell me how I can do the following - all the
> : elements in my array of unknown size should be initialized
> : to the value 0?
>
> Assuming your array has only one dimension:
>
> @array = (0
Vaishnavi Krishnamurthy wrote:
>
> Hello,
Hello,
> Can anyone tell me how I can do the following - all the elements in my
> array of unkown size should be initialised to the value 0 ?
@array = (0) x @array;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
vaishnavi krishnamurthy <[EMAIL PROTECTED]> wrote:
: Can anyone tell me how I can do the following - all the
: elements in my array of unknown size should be initialized
: to the value 0?
Assuming your array has only one dimension:
@array = (0) x @array;
HTH,
Charles K. Clarkson
-
Hi Vaish,
The size of your "unknown sized" array can be found using the function
scalar.
Here is one way to do it.
#! /usr/bin/perl -w
my @arrUnknownSize = (1,3,4);
for(my $i=0; $i < scalar(@arrUnknownSize); $i++) #try using the
condition $i <= scalar(@arrUnknownSize) and watch da fun!
{$ar