--- David Draley <[EMAIL PROTECTED]> wrote:
> What would be the best way to add only the even array elements?
>
> @array[0..9];
>
> #result of even elements
>
> thank you
David,
Just don't do:
use strict;
my @data = qw/ 1 2 3 4 5 9 /;
my $sum = 0;
map { $sum += $data[$_] if $
Hello again Maryana,
It appears that you are not following the format of the example given
below,
which is the cause of you error. You have the right idea about how to
call an
anonymous subroutine (like this: \&subroutine ). Here's a test script
with the
syntax you are looking for:
###
use
> -Original Message-
> From: David Draley [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 07, 2001 7:18 AM
> To: [EMAIL PROTECTED]
> Subject: adding array elements
>
>
> What would be the best way to add only the even array elements?
>
> @array[0..9];
>
> #result of even elements
> -Original Message-
> From: Rajeev Rumale [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 16, 2001 11:19 PM
> To: [EMAIL PROTECTED]
> Subject: Script compliation Sequence.
>
>
> Hello EveryBody
>
> I needed some advice for all.
>
> I am working on a untilty which needs to perform
Hi, Mark!
Thanx for answer - it's partly help me to resolve my problem (now I use
Data::FormValidator). Tnx for so usefull module ;o)
But to call my function I need do it in that way:
p1 => {
constraint => \&main::valid_equiv,
params => [ qw (p1 p2)],
},
whe
i can think of a few ways ...
# loop through the array and check the index
my $index = 1;
for my $value (@array)
{
next if $index%2;
push @only_even , $value;
$index++;
}
# or you can shift two elements and use the last one ...
for my $value (@array) {
# you can a
What would be the best way to add only the even array elements?
@array[0..9];
#result of even elements
thank you
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
To unsubscribe, e-mail: [EMAIL PRO