>>>>> "TB" == Thomas Bätzler <t.baetz...@bringe.com> writes:

  TB> Jon Forsyth <jon4s...@gmail.com> 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?

  TB> "my" declares a variable for the lexical scope. While Perl by
  TB> itself will happily let variables spring into existence whenever
  TB> you first refer to them, the accepted best practice is to run perl
  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.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to