>>>>> "TB" == Thomas Bätzler <[email protected]> writes:

  TB> Jon Forsyth <[email protected]> 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  ------  [email protected]  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to