;assume 0 isnt an element
$answer = 1;
for i=0 to i=$#array{
$answer *= @array[i];
}At 11:51 AM 6/9/2003, you wrote:
if the array is @array = (1,3,2,4,5), I would like to be able to multiply 1*3*2*4*5 and then get the total ($total). The only thing is that I am assuming that I do not know how many elements will be in the array. it will all depend on user input. Hope this helps
--- Jonathan Chan <[EMAIL PROTECTED]> wrote: > At 01:04 PM 6/8/2003, Issa Mbodji wrote: > > >How do I multiply array elements (e.g @array = > (1,2,3,4,5)) assuming that > >we do not initially know how many elements the > array will have. > > > multiply the array against what? > > if i remember right, $#array will return the the > index number of the last > element in the array. > > HTH, > jon >
__________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com
_______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
