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

Hmm, where did I mention Pi or cosines anywhere in my answer?

I am simply trying to help out beginners and tackle common programming
tasks that can be done in more of a Perl-ish way.

If you want to show a way to do something more complex, please do so.  If
you just want to be a smart-ass, please save it for a different list.

Brent




                                                                                       
                                        
                    blowther <[EMAIL PROTECTED]>                                     
                                        
                    Sent by:                                                 To:     
"'Brent Michalski'"                       
                    beginners-return-54-Brent_Michalski=mastercard.co        
<[EMAIL PROTECTED]>, Pacifico        
                    [EMAIL PROTECTED]                                               
<[EMAIL PROTECTED]>                  
                                                                             cc:     
[EMAIL PROTECTED]                        
                                                                             Subject:  
   RE: problem with variables           
                    04/17/01 03:06 PM                                                  
                                        
                                                                                       
                                        
                                                                                       
                                        




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