in reply to Re^4: redacting from config hash
in thread redacting from config hash

... my $Config = Config::Tiny->new; $Config = Config::Tiny->read( $ini_path , 'utf8' ); say Dumper \%Config; my $domain = $Config{$sub_hash}->{'domain'}; my $username = $Config{$sub_hash}->{'username'}; my $password = $Config{$sub_hash}->{'password'}; my $port = $Config{$sub_hash}->{'port'}; ... Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 215. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 216. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 217. Global symbol "%Config" requires explicit package name (did you forget + to declare "my %Config"?) at template_stuff/html4.pm line 218. ...

Config::Tiny returns a (blessed) reference to a hash, which is stored in the scalar $Config, so there is no %Config hash available. Both \%Config and $Config{$sub_hash} are however attempting to access a hash named %Config. Instead of Dumper \%Config, do Dumper $Config, and instead of $Config{$sub_hash}, say $Config->{$sub_hash}, and it should work. See perlreftut and perlref.

Replies are listed 'Best First'.
Re^6: redacting from config hash
by Aldebaran (Curate) on Aug 06, 2018 at 21:28 UTC

    I have a lot to learn when it comes to the syntax of hashes, and needed to be re-reminded of the abbreviation and the arrow rule. We've traversed a fairly wide arc in this thread from beginning with redacting to implementing Config::Tiny. I didn't get very far on the archiving itself and work on that presently. I do think that better usenet and perlmonks threads end when OP posts code that works. I ended up creating a new script that a) holds example values for the user to change when they customize their settings, and b) creates the .ini file that will populate values for dialing up a server. I'll post STDOUT, the .ini file, and then the script itself

    Of course, none of what works in the above code would have happened without the excellent comments and provision of source that this forum provided. Thank you.