chen li wrote:
>>>4)my $mean = do { my $s; $s += $_ for @data; $s /
>>>@data };
> 
> I never see the usage of "for" like this before. Is it
> equal to the following?

Yes, except that above $s is only visible inside the code block while below $s
is visible to the file.

> And where can I find some more
> like this?

See the "Statement Modifiers" section in:

perldoc perlsyn

> my $s;
> for(@data){$s += $_ ;}
> my $mean=$s/@data;


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to