in reply to Whether to use local()
My question is whether you should be concerned with scope if $new_mail needs to be shared between sub update_mail_list and sub read_mail_list etc.One trick I sometimes use to share a variable among multiple subroutines, without making it a package variable is to enclose all of them in a block.
What do monks think about this style?{ my $new_mail; sub update_mail_list { # uses $new_mail } sub read_mail_list { # uses $new_mail } }
Thanks,
/prakash
|
---|
Replies are listed 'Best First'. | |
---|---|
Re:x2 Whether to use local()
by grinder (Bishop) on Mar 15, 2002 at 20:05 UTC | |
Re (tilly) 2: Whether to use local()
by tilly (Archbishop) on Mar 16, 2002 at 14:31 UTC | |
by runrig (Abbot) on Mar 16, 2002 at 20:24 UTC |
In Section
Seekers of Perl Wisdom