So your saying that Perl can handle calculating cosine while iterating
through Pi?

for my $inc (-3.14159 .. 3.14159)
{
        push @result, cos($inc);
}

Come on... C style for loops have their place.



-----Original Message-----
From: Brent Michalski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 1:55 PM
To: Pacifico
Cc: [EMAIL PROTECTED]
Subject: Re: problem with variables



To add to the answer(s) already given...

for ($i=1 ; $i<4 ;$i++){
    print $sup($i);
}

is actually quite cumbersome, and very 'C'-ish...  Let's make it more
Perl-ish...

for my $i (1..4){
  print $i;
}

There is not need to have to deal with incrementing and checking conditions
in loops - Perl does this very nicely for us already...

brent



 

                    "Pacifico" <[EMAIL PROTECTED]>

                    Sent by:
To:     <[EMAIL PROTECTED]>                      
                    beginners-return-51-Brent_Michalski=mastercard.co
cc:                                               
                    [EMAIL PROTECTED]
Subject:     problem with variables               
 

 

                    04/17/01 09:59 AM

 

 





i have this program:

$sup1='a';
$sup2='b';
$sup3='c';

for ($i=1 ; $i<4 ;$i++){
    print $sup($i);
}

but give error, why???



Reply via email to