rchiav has asked for the wisdom of the Perl Monks concerning the following question:
What I didn't quite understand is that my variables that are declared in the main body of a program are accessable anywhere within that file/package. I realized this after I accidentially did what I thought you could not do; use a variable within a sub that was defined in the body of the script and not passed to the sub.
Now my question is more on the subject of best practices with Perl. Is it considered a faux pas to refrence these varialbes globally? Or is it considered redundant to pass them subs?
Or is there some other practice that I'm unaware of?
Thanks in advance
Rich
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Top level
by Ovid (Cardinal) on May 23, 2001 at 22:14 UTC | |
by petral (Curate) on May 24, 2001 at 00:02 UTC | |
by Ovid (Cardinal) on May 24, 2001 at 00:07 UTC | |
|
Re (tilly) 1: Top level
by tilly (Archbishop) on May 23, 2001 at 22:20 UTC | |
|
Re: Top level
by sierrathedog04 (Hermit) on May 23, 2001 at 22:22 UTC | |
|
Re: Top level
by tune (Curate) on May 23, 2001 at 22:09 UTC | |
|
Re: Top level my vars and their global use in a file
by stephen (Priest) on May 23, 2001 at 23:51 UTC | |
|
Re: Top level my vars and their global use in a file
by DrZaius (Monk) on May 23, 2001 at 23:39 UTC | |
|
Re: Top level
by DrSax (Sexton) on May 23, 2001 at 22:29 UTC |