Re: Syntax of Foreach loop

2010-03-31 Thread Shawn H Corey
On Tue, 30 Mar 2010 23:05:00 -0600 Jon Forsyth wrote: > I am truly a beginner. Could someone help me understand this syntax > out of a code example from "Learning Perl"? On line 5 I'm confused > as to why "my $number" is between "foreach" and the ()? is "my > $number part of the loop? Yes, it

AW: AW: Syntax of Foreach loop

2010-03-31 Thread Thomas Bätzler
Uri Guttman wrote: > > "TB" == Thomas Bätzler writes: > TB> with the -w switch or the "use warnings;" pragma which requires > TB> variables to be declared before their first use. > > that is the use strict pragma, not the warnings one. Of course. I knew I shouldn't have posted befor

Re: AW: Syntax of Foreach loop

2010-03-30 Thread Uri Guttman
> "TB" == Thomas Bätzler writes: TB> Jon Forsyth asked: >> I am truly a beginner. Could someone help me understand this syntax >> out of a code example from "Learning Perl"? On line 5 I'm confused >> as to why "my $number" is between "foreach" and the ()? is "my >> $number part

AW: Syntax of Foreach loop

2010-03-30 Thread Thomas Bätzler
Jon Forsyth asked: > I am truly a beginner. Could someone help me understand this syntax > out of a code example from "Learning Perl"? On line 5 I'm confused > as to why "my $number" is between "foreach" and the ()? is "my > $number part of the loop? "my" declares a variable for the lexical sc

Syntax of Foreach loop

2010-03-30 Thread Jon Forsyth
I am truly a beginner. Could someone help me understand this syntax out of a code example from "Learning Perl"? On line 5 I'm confused as to why "my $number" is between "foreach" and the ()? is "my $number part of the loop? sub running_sum { state $sum = 0; state @numbers; foreach my $