PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
To my understanding of localisation, all "my" variables shouldd be available within the encapsulated subs. Yet I get an error saying they will not stay shared. Why is that? what do I need to do?sub my_func{ my ( $self, $ptr_array, $value ) = @_; return look_right() if ( $value == 0 ); return look_left() if ( $value == @{ $ptr_array } ); return ( look_right() && look_left() ); sub look_right() {... [uses $value and $ptr_array] } sub look_left() {... [uses $value and $ptr_array] } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My Confusion
by borisz (Canon) on Sep 08, 2004 at 12:53 UTC | |
by PerlingTheUK (Hermit) on Sep 08, 2004 at 13:14 UTC | |
|
Re: My Confusion
by Fletch (Bishop) on Sep 08, 2004 at 13:02 UTC | |
|
Re: Nested subroutines and access to variables in an outer scope
by Aristotle (Chancellor) on Sep 08, 2004 at 21:15 UTC | |
by borisz (Canon) on Sep 08, 2004 at 23:26 UTC |