Thanks
I was declaring the variable using "my" within the package, which I suppose hid it from being referenced outside the package. I changed it to "our", and it works now.
I was never fully clear on exactly what "our" does, although I've read the manual's description of it many times.
Here's my application:
I have a package MyDefs.pm that I'm using to define config variables that other packages will reference.
Here's part of it:
package MyDefs;
use strict;
use warnings;
use re 'taint'; # suppress untainting by regexes
# paths
our $home_dir = 'c:';
our $dest_base_dir = "$home_dir/backup";
our $lock_filename = $dest_base_dir/backup_lock";
our $list_filename = 'backup.lst';
Then in other packages, I reference the variables like this:
use MyDefs();
open(my $fh_lock, '>', $MyDefs::lock_filename) or die "open: $!";
Does that seem like reasonable coding practice?
I had forgotten how complicated Perl is, compared to PHP.