More About Lexical Variables
- They can be put anywhere you need scoped variables
- On the last slide, $current was scoped to the foreach block
- Any blocks at all:
if ( $pets ) {
my $name = 'Sparky';
...
| CPU: Perl, Fall 2005 | Perl, Week 3: More Arrays, Context, Subroutines, Lexical Variables | #53 |
if ( $pets ) {
my $name = 'Sparky';
...
| Copyright © 2005 Ian Langworth |